protected function DocLexer::getType

Parameters

string $value:

Return value

int

Overrides Lexer::getType

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php, line 100

Class

DocLexer
Simple lexer for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

protected function getType(&$value) {
  $type = self::T_NONE;
  if ($value[0] === '"') {
    $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2));
    return self::T_STRING;
  }
  if (isset($this->noCase[$value])) {
    return $this->noCase[$value];
  }
  if ($value[0] === '_' || $value[0] === '\\' || ctype_alpha($value[0])) {
    return self::T_IDENTIFIER;
  }
  $lowerValue = strtolower($value);
  if (isset($this->withCase[$lowerValue])) {
    return $this->withCase[$lowerValue];
  }

  // Checking numeric value
  if (is_numeric($value)) {
    return strpos($value, '.') !== false || stripos($value, 'e') !== false ? self::T_FLOAT : self::T_INTEGER;
  }
  return $type;
}