Passed
Push — master ( 73bfc2...a878a7 )
by Adrien
13:45 queued 10:48
created

GraphQLHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Handler;
6
7
use Ecodev\Felix\Api\Server;
8
use Laminas\Diactoros\Response\JsonResponse;
9
use Psr\Http\Message\ResponseInterface;
10
use Psr\Http\Message\ServerRequestInterface;
11
use Psr\Http\Server\RequestHandlerInterface;
12
13
final class GraphQLHandler implements RequestHandlerInterface
14
{
15
    public function __construct(private readonly Server $server)
16
    {
17
    }
18
19
    /**
20
     * Process an incoming server request and return a response, optionally delegating
21
     * to the next middleware component to create the response.
22
     */
23
    public function handle(ServerRequestInterface $request): ResponseInterface
24
    {
25
        $response = $this->server->execute($request);
26
27
        return new JsonResponse($response);
28
    }
29
}
30