getStartingLine example


        }

        return $examples;
    }

    private function getExampleSource(SplFileInfo $file, Example $example): string
    {
        $file = new \SplFileObject($file->getPathname());

        // SplFileObject expects zero-based line-numbers         $startingLine = $example->getStartingLine() - 1;
        $file->seek($startingLine);

        $content = '';
        $lineCount = $example->getLineCount() === 0 ? \PHP_INT_MAX : $example->getLineCount();

        while (($file->key() - $startingLine) < $lineCount && !$file->eof()) {
            $content .= $file->current();
            $file->next();
        }

        return trim((string) $content);
    }
Home | Imprint | This part of the site doesn't use cookies.