• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 10807547456

11 Sep 2024 08:04AM UTC coverage: 69.746% (-0.1%) from 69.854%
10807547456

push

github

web-flow
feat(symfony): add error page (#6389)

0 of 7 new or added lines in 1 file covered. (0.0%)

3163 of 4535 relevant lines covered (69.75%)

73.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Symfony/Action/ErrorPageAction.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Symfony\Action;
15

16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Response;
18
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
19

20
final class ErrorPageAction
21
{
22
    public function __invoke(Request $request): Response
23
    {
NEW
24
        $status = $request->attributes->get('status');
×
NEW
25
        $text = Response::$statusTexts[$status] ?? throw new NotFoundHttpException();
×
26

NEW
27
        return new Response(<<<HTML
×
NEW
28
<!DOCTYPE html>
×
29
<html>
30
<head>
31
  <meta charset="UTF-8" />
NEW
32
  <title>Error $status</title>
×
33
    </head>
NEW
34
    <body><h1>Error $status</h1>$text</body>
×
35
</html>
NEW
36
HTML);
×
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc