| @@ 8-32 (lines=25) @@ | ||
| 5 | ||
| 6 | use Throwable; |
|
| 7 | ||
| 8 | class RenderFailedException extends TemplateException |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var string |
|
| 12 | */ |
|
| 13 | private $source; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param string $source |
|
| 17 | * @param Throwable|null $previous |
|
| 18 | */ |
|
| 19 | public function __construct(string $source, Throwable $previous = null) |
|
| 20 | { |
|
| 21 | $this->source = $source; |
|
| 22 | parent::__construct(sprintf('Failed to render source: %s', $this->source()), 0, $previous); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return string |
|
| 27 | */ |
|
| 28 | public function source(): string |
|
| 29 | { |
|
| 30 | return $this->source; |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 9-33 (lines=25) @@ | ||
| 6 | use Exception; |
|
| 7 | use Throwable; |
|
| 8 | ||
| 9 | class TemplateNotFoundException extends TemplateException |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @var string |
|
| 13 | */ |
|
| 14 | private $path; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @param string $path |
|
| 18 | * @param Throwable|null $previous |
|
| 19 | */ |
|
| 20 | public function __construct(string $path, Throwable $previous = null) |
|
| 21 | { |
|
| 22 | $this->path = $path; |
|
| 23 | parent::__construct(sprintf('Template file not found: %s', $this->path()), 0, $previous); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return string |
|
| 28 | */ |
|
| 29 | public function path(): string |
|
| 30 | { |
|
| 31 | return $this->path; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||