Total Complexity | 6 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
22 | final class SerializeFormatResolver |
||
23 | { |
||
24 | private RequestStack $requestStack; |
||
25 | private string $defaultFormat; |
||
26 | |||
27 | 6 | public function __construct(RequestStack $requestStack, string $defaultFormat = 'jsonld') |
|
31 | 6 | } |
|
32 | |||
33 | 2 | public function getFormat(): string |
|
34 | { |
||
35 | 2 | $request = $this->requestStack->getMasterRequest(); |
|
36 | 2 | if (!$request) { |
|
37 | 1 | return $this->defaultFormat; |
|
38 | } |
||
39 | |||
40 | 1 | return $this->getFormatFromRequest($request); |
|
41 | } |
||
42 | |||
43 | 5 | public function getFormatFromRequest(Request $request): string |
|
46 | } |
||
47 | } |
||
48 |