Conditions | 5 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 9.2876 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 36 | public function onKernelController(FilterControllerEvent $event) |
|
13 | { |
||
14 | 36 | $request = $event->getRequest(); |
|
15 | |||
16 | 36 | if ($request->getContentType() != 'json' || !$request->getContent()) { |
|
17 | 36 | return; |
|
18 | } |
||
19 | |||
20 | $data = json_decode($request->getContent(), true); |
||
21 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
22 | throw new BadRequestHttpException('Invalid json body: ' . json_last_error_msg()); |
||
23 | } |
||
24 | |||
25 | $request->request->replace(is_array($data) ? $data : []); |
||
26 | } |
||
27 | /** |
||
36 | } |