public function PHP_Token_FUNCTION::getName in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/php-token-stream/src/Token.php \PHP_Token_FUNCTION::getName()
Return value
string
1 call to PHP_Token_FUNCTION::getName()
- PHP_Token_FUNCTION::getSignature in vendor/
phpunit/ php-token-stream/ src/ Token.php
File
- vendor/
phpunit/ php-token-stream/ src/ Token.php, line 340
Class
Code
public function getName() {
if ($this->name !== null) {
return $this->name;
}
$tokens = $this->tokenStream
->tokens();
for ($i = $this->id + 1; $i < count($tokens); $i++) {
if ($tokens[$i] instanceof PHP_Token_STRING) {
$this->name = (string) $tokens[$i];
break;
}
elseif ($tokens[$i] instanceof PHP_Token_AMPERSAND && $tokens[$i + 1] instanceof PHP_Token_STRING) {
$this->name = (string) $tokens[$i + 1];
break;
}
elseif ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) {
$this->name = 'anonymous function';
break;
}
}
if ($this->name != 'anonymous function') {
for ($i = $this->id; $i; --$i) {
if ($tokens[$i] instanceof PHP_Token_NAMESPACE) {
$this->name = $tokens[$i]
->getName() . '\\' . $this->name;
break;
}
if ($tokens[$i] instanceof PHP_Token_INTERFACE) {
break;
}
}
}
return $this->name;
}