lithium\analysis\Parser::matchToken()
Compares two PHP language tokens.
Parameters
-
array
$pattern
Pattern token.
-
array
$token
Token to be compared.
Returns
booleanMatch result.
Source
public static function matchToken($pattern, $token) {
if ($pattern['name'] !== $token['name']) {
return false;
}
if (!isset($pattern['content'])) {
return true;
}
$match = $pattern['content'];
$content = $token['content'];
if ($pattern['name'] === 'T_VARIABLE') {
$match = substr($match, 1);
$content = substr($content, 1);
}
switch (true) {
case ($match === '_' || $match === $content):
return true;
}
return false;
}