protected function DocLexer::getType in Plug 7
Retrieve token type. Also processes the token value if necessary.
Parameters
string $value:
Return value
integer
Overrides AbstractLexer::getType
File
- lib/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ DocLexer.php, line 102
Class
- DocLexer
- Simple lexer for docblock annotations.
Namespace
Doctrine\Common\AnnotationsCode
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;
}