69 public function validate($string, $config, $context)
72 $bits = explode(
' ', $string);
75 $keywords[
'h'] =
false;
76 $keywords[
'v'] =
false;
77 $keywords[
'ch'] =
false;
78 $keywords[
'cv'] =
false;
91 foreach ($bits as $bit) {
97 $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
98 if (isset($lookup[$lbit])) {
99 $status = $lookup[$lbit];
100 if ($status ==
'c') {
107 $keywords[$status] = $lbit;
112 $r = $this->length->validate($bit, $config, $context);
119 $r = $this->percentage->validate($bit, $config, $context);
133 if ($keywords[
'h']) {
134 $ret[] = $keywords[
'h'];
135 } elseif ($keywords[
'ch']) {
136 $ret[] = $keywords[
'ch'];
137 $keywords[
'cv'] =
false;
138 } elseif (count($measures)) {
139 $ret[] = array_shift($measures);
142 if ($keywords[
'v']) {
143 $ret[] = $keywords[
'v'];
144 } elseif ($keywords[
'cv']) {
145 $ret[] = $keywords[
'cv'];
146 } elseif (count($measures)) {
147 $ret[] = array_shift($measures);
153 return implode(
' ',
$ret);