Total Complexity | 3 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 81.82% |
Changes | 4 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | final class KernelClient |
||
14 | { |
||
15 | private Kernel $kernel; |
||
16 | private RequestFactoryInterface $requestFactory; |
||
17 | private ?Response $response; |
||
18 | |||
19 | 1 | public function __construct(Kernel $kernel, RequestFactoryInterface $requestFactory) |
|
20 | { |
||
21 | 1 | $this->kernel = $kernel; |
|
22 | 1 | $this->requestFactory = $requestFactory; |
|
23 | 1 | } |
|
24 | |||
25 | /** |
||
26 | * Performs request on the kernel |
||
27 | * |
||
28 | * @param string $method |
||
29 | * @param string $uri |
||
30 | * @param string[][] $options |
||
31 | * @return Response |
||
32 | */ |
||
33 | 1 | public function request(string $method, string $uri, array $options = []): Response |
|
34 | { |
||
35 | 1 | return $this->response = $this->kernel |
|
36 | 1 | ->reboot() |
|
37 | 1 | ->handleRequest( |
|
38 | 1 | $this->requestFactory->create($method, $uri, $options) |
|
39 | ); |
||
40 | } |
||
41 | |||
42 | public function getResponse(): ?Response |
||
45 | } |
||
46 | } |
||
47 |