for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright 2018 Vladimir Jimenez
* @license https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
*/
namespace allejo\stakx\Templating\Twig;
use allejo\stakx\Templating\TemplateErrorInterface;
class TwigError extends \Exception implements TemplateErrorInterface
{
private $error;
private $content;
private $relativeFilePath;
private $name;
public function __construct(\Twig_Error $error)
$this->error = $error;
$this->message = $error->getRawMessage();
}
* {@inheritdoc}
public function getTemplateLine()
return $this->error->getTemplateLine();
public function setTemplateLine($lineNumber)
$this->error->setTemplateLine($lineNumber);
return $this;
public function setContent($content)
$this->content = $content;
public function setName($name)
$this->name = $name;
public function setRelativeFilePath($filePath)
$this->relativeFilePath = $filePath;
public function buildException()
$this->error->setSourceContext(new \Twig_Source(
$this->content,
$this->name,
$this->relativeFilePath
));