You are here

public function PHP_Token_FUNCTION::getArguments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/php-token-stream/src/Token.php \PHP_Token_FUNCTION::getArguments()

Return value

array

File

vendor/phpunit/php-token-stream/src/Token.php, line 306

Class

PHP_Token_FUNCTION

Code

public function getArguments() {
  if ($this->arguments !== null) {
    return $this->arguments;
  }
  $this->arguments = array();
  $tokens = $this->tokenStream
    ->tokens();
  $typeDeclaration = null;

  // Search for first token inside brackets
  $i = $this->id + 2;
  while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) {
    $i++;
  }
  while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) {
    if ($tokens[$i] instanceof PHP_Token_STRING) {
      $typeDeclaration = (string) $tokens[$i];
    }
    elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) {
      $this->arguments[(string) $tokens[$i]] = $typeDeclaration;
      $typeDeclaration = null;
    }
    $i++;
  }
  return $this->arguments;
}