public function PHP_TokenWithScopeAndVisibility::getVisibility in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/php-token-stream/src/Token.php \PHP_TokenWithScopeAndVisibility::getVisibility()
Return value
string
File
- vendor/
phpunit/ php-token-stream/ src/ Token.php, line 178
Class
Code
public function getVisibility() {
$tokens = $this->tokenStream
->tokens();
for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
if (isset($tokens[$i]) && ($tokens[$i] instanceof PHP_Token_PRIVATE || $tokens[$i] instanceof PHP_Token_PROTECTED || $tokens[$i] instanceof PHP_Token_PUBLIC)) {
return strtolower(str_replace('PHP_Token_', '', get_class($tokens[$i])));
}
if (isset($tokens[$i]) && !($tokens[$i] instanceof PHP_Token_STATIC || $tokens[$i] instanceof PHP_Token_FINAL || $tokens[$i] instanceof PHP_Token_ABSTRACT)) {
// no keywords; stop visibility search
break;
}
}
}