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