public function Lexer::getLiteral

Gets the literal for a given token.

Parameters

integer $token:

Return value

string

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php, line 230

Class

Lexer
Base class for writing simple lexers, i.e. for creating small DSLs.

Namespace

Doctrine\Common

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