28 lines
448 B
PHP
Executable File
28 lines
448 B
PHP
Executable File
<?php
|
|
|
|
class ElementEnum extends ElementSet {
|
|
|
|
private static $schema;
|
|
|
|
public static function getSchema ( $params = array() ) {
|
|
|
|
$params['type'] = 'enum';
|
|
return $params;
|
|
|
|
}
|
|
|
|
public static function invalid ( $schema, $value, $data = array() ) {
|
|
|
|
if ( $error = parent::invalid($value, $data) )
|
|
return $error;
|
|
|
|
if ( is_null($value) || is_string($value) )
|
|
return false;
|
|
|
|
return 'Value is not an enum !';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|