Asm89\Twig\Lint\Command\LintCommand::validateTemplate PHP Method

validateTemplate() protected method

protected validateTemplate ( Twig_Environment $twig, Asm89\Twig\Lint\Output\OutputInterface $output, $template, $file = null, $onlyPrintErrors = false )
$twig Twig_Environment
$output Asm89\Twig\Lint\Output\OutputInterface
    protected function validateTemplate(\Twig_Environment $twig, OutputInterface $output, $template, $file = null, $onlyPrintErrors = false)
    {
        try {
            $twig->parse($twig->tokenize($template, $file ? (string) $file : null));
            if (false === $onlyPrintErrors) {
                $output->ok($template, $file);
            }
        } catch (\Twig_Error $e) {
            $output->error($template, $e, $file);
            return 1;
        }
        return 0;
    }