protected function DocLexer::getType in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php \Doctrine\Common\Annotations\DocLexer::getType()
Retrieve token type. Also processes the token value if necessary.
Parameters
string $value:
Return value
integer
Overrides AbstractLexer::getType
File
- vendor/
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;
}