Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ErrorController | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Controller; |
| 4 | |
| 5 | use Olz\Components\Error\OlzErrorPage\OlzErrorPage; |
| 6 | use Psr\Log\LoggerInterface; |
| 7 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 8 | use Symfony\Component\HttpFoundation\Request; |
| 9 | use Symfony\Component\HttpFoundation\Response; |
| 10 | use Symfony\Component\Routing\Annotation\Route; |
| 11 | |
| 12 | class ErrorController extends AbstractController { |
| 13 | #[Route('/error/{code}', requirements: ['code' => '[0-9]{3}'])] |
| 14 | public function index( |
| 15 | Request $request, |
| 16 | LoggerInterface $logger, |
| 17 | OlzErrorPage $olzErrorPage, |
| 18 | string $code, |
| 19 | ): Response { |
| 20 | $logger->info('Intentional error', ['code' => $code]); |
| 21 | $out = $olzErrorPage->getHtml(['http_status_code' => intval($code)]); |
| 22 | return new Response($out); |
| 23 | } |
| 24 | } |