20 public function validate($string, $config, $context) {
24 if ($string ===
'')
return false;
25 if ($string ===
'0')
return '0';
26 if (strlen($string) === 1)
return false;
29 if (!$length->isValid())
return false;
32 $c = $length->compareTo($this->min);
33 if ($c ===
false)
return false;
34 if ($c < 0)
return false;
37 $c = $length->compareTo($this->max);
38 if ($c ===
false)
return false;
39 if ($c > 0)
return false;
42 return $length->toString();
__construct($min=null, $max=null)
Base class for all validating attribute definitions.
Represents a Length as defined by CSS.
validate($string, $config, $context)
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.