Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class ApiVersion implements HttpKernelInterface |
||
15 | { |
||
16 | use Util\Mime; |
||
17 | |||
18 | protected Application $app; |
||
19 | |||
20 | 1 | public function __construct(Application $app) |
|
23 | 1 | } |
|
24 | |||
25 | /** |
||
26 | * @param BaseRequest $request |
||
27 | * @param int $type |
||
28 | * @param bool $catch |
||
29 | * |
||
30 | * @return Response |
||
31 | */ |
||
32 | 1 | public function handle(BaseRequest $request, $type = self::MASTER_REQUEST, $catch = true) |
|
33 | { |
||
34 | 1 | $request = new Request($request); |
|
35 | 1 | $mimeProcResult = $this->processMime( |
|
36 | 1 | (new FormatNegotiator())->getBest($request->headers->get('Accept', '*/*'))->getValue() |
|
37 | ); |
||
38 | |||
39 | $request->setApiVersion( |
||
40 | str_pad($mimeProcResult->apiVersion, 3, '.0') |
||
41 | ); |
||
42 | |||
43 | return $this->app->handle($request, $type, $catch); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return ContainerInterface |
||
48 | */ |
||
49 | 1 | public function getContainer() |
|
52 | } |
||
53 | } |
||
54 |