public function AbstractLexer::getLiteral in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_annotation_discovery/lib/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
- modules/
providers/ service_container_annotation_discovery/ lib/ Doctrine/ lexer/ lib/ Doctrine/ Common/ Lexer/ AbstractLexer.php, line 229
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;
}