Completed
Push — master ( 0eea34...d1e6c1 )
by n
03:33
created

RoutingErrorResponder::respond()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Routing;
5
6
use N1215\Http\Router\RoutingErrorInterface;
7
use N1215\Http\Router\RoutingErrorResponderInterface;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Zend\Diactoros\Response\JsonResponse;
11
12
class RoutingErrorResponder implements RoutingErrorResponderInterface
13
{
14 1
    public function respond(ServerRequestInterface $request, RoutingErrorInterface $error): ResponseInterface
15
    {
16 1
        return new JsonResponse(['message' => $error->getMessage()], $error->getStatusCode());
17
    }
18
}
19