15 public function validate($string, $config, $context) {
17 $string = trim($string);
18 if ($string ===
'0')
return $string;
19 if ($string ===
'')
return false;
20 $length = strlen($string);
21 if (substr($string, $length - 2) ==
'px') {
22 $string = substr($string, 0, $length - 2);
24 if (!is_numeric($string))
return false;
27 if ($int < 0)
return '0';
33 if ($this->max !== null && $int > $this->max)
return (
string)
$this->max;
39 public function make($string) {
40 if ($string ===
'')
$max = null;
41 else $max = (int) $string;
42 $class = get_class($this);
43 return new $class(
$max);