Opis\Closure\ReflectionClosure::getTokens PHP Method

getTokens() protected method

protected getTokens ( ) : array
return array
    protected function getTokens()
    {
        if ($this->tokens === null) {
            $tokens = $this->getFileTokens();
            $startLine = $this->getStartLine();
            $endLine = $this->getEndLine();
            $results = array();
            $start = false;
            foreach ($tokens as &$token) {
                if (!is_array($token)) {
                    if ($start) {
                        $results[] = $token;
                    }
                    continue;
                }
                $line = $token[2];
                if ($line <= $endLine) {
                    if ($line >= $startLine) {
                        $start = true;
                        $results[] = $token;
                    }
                    continue;
                }
                break;
            }
            $this->tokens = $results;
        }
        return $this->tokens;
    }