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,
        ];
    }