44 $string = trim($string);
45 if (!$this->case_sensitive) {
47 $string = ctype_lower($string) ? $string : strtolower($string);
49 $result = isset($this->valid_values[$string]);
51 return $result ? $string :
false;
60 public function make($string)
62 if (strlen($string) > 2 && $string[0] ==
's' && $string[1] ==
':') {
63 $string = substr($string, 2);
68 $values = explode(
',', $string);
Base class for all validating attribute definitions.
validate($string, $config, $context)
__construct($valid_values=array(), $case_sensitive=false)
$case_sensitive
Bool indicating whether or not enumeration is case sensitive.
$valid_values
Lookup table of valid values.
Validates a keyword against a list of valid values.