You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
<?php
|
|
abstract class AbstractField implements IField {
|
|
protected $name;
|
|
protected $value;
|
|
protected $validators = [];
|
|
|
|
public function __construct($name) {
|
|
$this->name = $name;
|
|
}
|
|
|
|
public function getName() {
|
|
return $this->name;
|
|
}
|
|
|
|
// Autres méthodes...
|
|
}
|
|
|
|
// abstract class AbstractField {
|
|
// protected $name;
|
|
// protected $value;
|
|
// protected $attributes;
|
|
// protected $errors = [];
|
|
// protected $validators = [];
|
|
|
|
// public function __construct($name, $value = '', $attributes = []) {
|
|
// $this->name = $name;
|
|
// $this->value = $value;
|
|
// $this->attributes = $attributes;
|
|
// }
|
|
|
|
// public function getName() {
|
|
// return $this->name;
|
|
// }
|
|
|
|
// public function getValue() {
|
|
// return $this->value;
|
|
// }
|
|
|
|
// public function setValue($value) {
|
|
// $this->value = $value;
|
|
// }
|
|
|
|
// public function addValidator(callable $validator) {
|
|
// $this->validators[] = $validator;
|
|
// return $this;
|
|
// }
|
|
|
|
// public function isValid() {
|
|
// foreach ($this->validators as $validator) {
|
|
// if (!$validator($this->value)) {
|
|
// return false;
|
|
// }
|
|
// }
|
|
// return true;
|
|
// }
|
|
|
|
// public function getErrors() {
|
|
// return $this->errors;
|
|
// }
|
|
|
|
// public function addError($error) {
|
|
// $this->errors[] = $error;
|
|
// }
|
|
|
|
// public function getAttributesAsString() {
|
|
// $attributesStr = '';
|
|
// foreach ($this->attributes as $key => $value) {
|
|
// $attributesStr .= " $key=\"$value\"";
|
|
// }
|
|
// return $attributesStr;
|
|
// }
|
|
|
|
// abstract public function render();
|
|
// }
|