picea/src/Exception/RenderHtmlException.php

40 lines
1.0 KiB
PHP

<?php
namespace Picea\Exception;
use Picea\Picea;
/**
* Whenever an error occured rendering a view, this is the exception that will show up.
*
*/
class RenderHtmlException extends \Exception
{
public function __construct(object $template, string $message, int $code, \Throwable $previous)
{
parent::__construct($message, $code, $previous);
$this->defineError($previous, $template);
}
protected function defineError(\Throwable $previous, object $template) : void
{
/*$loadedTemplates = array_flip($this->picea->loadedTemplateFile);*/
$this->file = $template::getParam('view');
$this->line = $template::getSourceLineFromException($previous->getLine());
}
protected function getTemplateFile(string $filePath) : ? array
{
$content = null;
if ( is_array($content) && isset($content['classname'], $content['namespace'], $content['view'], $content['extends']) ) {
return $content;
}
return null;
}
}