You are here

public function PHP_Token_Stream::getFunctionForLine in Zircon Profile 8

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

Returns the name of the function or method a line belongs to.

@since Method available since Release 1.2.0

Return value

string or null if the line is not in a function or method

File

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

Class

PHP_Token_Stream
A stream of PHP tokens.

Code

public function getFunctionForLine($line) {
  $this
    ->parse();
  if (isset($this->lineToFunctionMap[$line])) {
    return $this->lineToFunctionMap[$line];
  }
}