Asm89\Twig\Lint\Output\FullOutput::getContext PHP Method

getContext() protected method

protected getContext ( $template, $line, $context = 3 )
    protected function getContext($template, $line, $context = 3)
    {
        $lines = explode("\n", $template);
        $position = max(0, $line - $context);
        $max = min(count($lines), $line - 1 + $context);
        $result = array();
        while ($position < $max) {
            $result[$position + 1] = $lines[$position];
            $position++;
        }
        return $result;
    }