57 $bits = explode(
' ', $string);
60 $keywords[
'h'] =
false;
61 $keywords[
'v'] =
false;
62 $keywords[
'ch'] =
false;
63 $keywords[
'cv'] =
false;
76 foreach ($bits as $bit) {
77 if ($bit ===
'')
continue;
80 $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
81 if (isset($lookup[$lbit])) {
82 $status = $lookup[$lbit];
90 $keywords[$status] = $lbit;
95 $r = $this->length->validate($bit,
$config, $context);
102 $r = $this->percentage->validate($bit,
$config, $context);
110 if (!$i)
return false;
115 if ($keywords[
'h'])
$ret[] = $keywords[
'h'];
116 elseif ($keywords[
'ch']) {
117 $ret[] = $keywords[
'ch'];
118 $keywords[
'cv'] =
false;
120 elseif (count($measures))
$ret[] = array_shift($measures);
122 if ($keywords[
'v'])
$ret[] = $keywords[
'v'];
123 elseif ($keywords[
'cv'])
$ret[] = $keywords[
'cv'];
124 elseif (count($measures))
$ret[] = array_shift($measures);
126 if (empty(
$ret))
return false;
127 return implode(
' ',
$ret);