Conditions | 6 |
Paths | 8 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function __invoke(RequestEvent $event): void |
||
30 | { |
||
31 | if (!$event->isMasterRequest()) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | $request = $event->getRequest(); |
||
36 | |||
37 | if ($request->headers->has(self::HEADER_CONTENT_TYPE)) { |
||
38 | $contentType = $request->headers->all(self::HEADER_CONTENT_TYPE); |
||
39 | |||
40 | if (\is_array($contentType)) { |
||
41 | $contentType = \implode(',', $contentType); |
||
42 | } |
||
43 | $contentType = (string) $contentType; |
||
44 | |||
45 | if (\mb_substr_count($contentType, 'application/json') > 0) { |
||
46 | $data = \json_decode((string) $request->getContent(), true); |
||
47 | |||
48 | if (\is_array($data)) { |
||
49 | $request->request = new ParameterBag($data); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 | |||
63 |