You are here

public function PHP_TokenWithScopeAndVisibility::getVisibility in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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

PHP_TokenWithScopeAndVisibility

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;
    }
  }
}