Skip to content

Commit

Permalink
Merge pull request #7 from spiral-packages/feature/verbose-template
Browse files Browse the repository at this point in the history
Adaptation HTML error template to the spiral framework
  • Loading branch information
butschster authored Apr 19, 2023
2 parents afd3bcd + 56598bd commit d5d885e
Show file tree
Hide file tree
Showing 4 changed files with 1,648 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^8.1",
"spiral/boot": "^3.0",
"spiral/exceptions": "^3.0",
"yiisoft/error-handler": "^2.1"
"yiisoft/error-handler": "^2.1 || ^3.0"
},
"require-dev": {
"spiral/http": "^3.0",
Expand Down
8 changes: 7 additions & 1 deletion src/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
final class HtmlRenderer implements ExceptionRendererInterface
{
public const FORMATS = ['html', 'application/html', 'text/html'];
private readonly ThrowableRendererInterface $renderer;

public function __construct(
private readonly ?ThrowableRendererInterface $renderer = new YiiHtmlRenderer()
?ThrowableRendererInterface $renderer = null,
) {
$this->renderer = $renderer ?? new YiiHtmlRenderer(
settings: [
'verboseTemplate' => dirname(__DIR__) . '/templates/development.php',
]
);
}

public function render(
Expand Down
Loading

0 comments on commit d5d885e

Please sign in to comment.