private function addTemplate(TemplateReferenceInterface $reference)
    {
        if ($reference->get('engine') !== 'twig') {
            return $this;
        }

        if (false !== ($path = $this->resolvePath($reference->getPath()))) {
            $this->templates[] = $path;
            return $this->addPath($path);
        }
        return $this;
    }