public function AbstractLexer::getLiteral in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php \Doctrine\Common\Lexer\AbstractLexer::getLiteral()
Gets the literal for a given token.
Parameters
integer $token:
Return value
string
File
- vendor/
doctrine/ lexer/ lib/ Doctrine/ Common/ Lexer/ AbstractLexer.php, line 280
Class
- AbstractLexer
- Base class for writing simple lexers, i.e. for creating small DSLs.
Namespace
Doctrine\Common\LexerCode
public function getLiteral($token) {
$className = get_class($this);
$reflClass = new \ReflectionClass($className);
$constants = $reflClass
->getConstants();
foreach ($constants as $name => $value) {
if ($value === $token) {
return $className . '::' . $name;
}
}
return $token;
}