protected function validate($template, $file = null)
    {
        try {
            $this->twig->parse($this->twig->tokenize($template, $file));
        } catch (Error $e) {
            return [
                'template'  => $template,
                'file'      => $file,
                'valid'     => false,
                'exception' => $e,
            ];
        }

        return [
            'template'  => $template,
            'file'      => $file,
            'valid'     => true,
        ];
    }
protected function validate($template, $file = null)
    {
        try {
            $this->twig->parse($this->twig->tokenize($template, $file));
        } catch (Error $e) {
            return [
                'template'  => $template,
                'file'      => $file,
                'valid'     => false,
                'exception' => $e,
            ];
        }

        return [
            'template'  => $template,
            'file'      => $file,
            'valid'     => true,
        ];
    }
protected function validate ( $ template , $ file = null ) { try { $ this -> twig -> parse ( $ this -> twig -> tokenize ( $ template , $ file ) ) ; } catch ( Error $ e ) { return [ 'template' => $ template , 'file' => $ file , 'valid' => false , 'exception' => $ e , ] ; } return [ 'template' => $ template , 'file' => $ file , 'valid' => true , ] ; }
Validate the template.

@param string $template Twig template.
@param string $file     Filename of the template.

@return array
Validate the template .