You are here

public function AbstractLexer::getLiteral in Plug 7

Gets the literal for a given token.

Parameters

integer $token:

Return value

string

File

lib/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\Lexer

Code

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;
}