9 public function validate($string, $config, $context) {
11 $string = trim($string);
14 if (!$string)
return false;
16 $tokens = $this->
split($string, $config, $context);
17 $tokens = $this->
filter($tokens, $config, $context);
18 if (empty($tokens))
return false;
19 return implode(
' ', $tokens);
26 protected function split($string, $config, $context) {
34 $pattern =
'/(?:(?<=\s)|\A)'.
35 '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'.
37 preg_match_all($pattern, $string, $matches);
46 protected function filter($tokens, $config, $context) {