| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 9 | public function onKernelRequest(RequestEvent $event): void |
|
| 34 | { |
||
| 35 | 9 | $request = $event->getRequest(); |
|
| 36 | |||
| 37 | 9 | if (false === $this->supports($request)) { |
|
| 38 | 7 | return; |
|
| 39 | } |
||
| 40 | |||
| 41 | try { |
||
| 42 | /** @var array|scalar $data */ |
||
| 43 | 2 | $data = json_decode((string) $request->getContent(), true, 512, JSON_THROW_ON_ERROR); |
|
| 44 | |||
| 45 | 1 | if (is_array($data)) { |
|
| 46 | 1 | $request->request->replace($data); |
|
| 47 | } |
||
| 48 | 1 | } catch (JsonException $exception) { |
|
| 49 | 1 | throw new BadRequestHttpException($exception->getMessage()); |
|
| 50 | } |
||
| 58 |