14 $string = trim($string);
15 if ($string ===
'')
return false;
17 $parent_result = parent::validate($string,
$config, $context);
18 if ($parent_result !==
false)
return $parent_result;
20 $length = strlen($string);
21 $last_char = $string[$length - 1];
23 if ($last_char !==
'*')
return false;
25 $int = substr($string, 0, $length - 1);
27 if ($int ==
'')
return '*';
28 if (!is_numeric($int))
return false;
32 if ($int < 0)
return false;
33 if ($int == 0)
return '0';
34 if ($int == 1)
return '*';
35 return ((
string) $int) .
'*';