Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function logAction(Request $request) |
||
14 | { |
||
15 | $csp_report = new CSPReport(); |
||
16 | $form = $this->createForm(CSPReportType::class, $csp_report); |
||
17 | if ($request->isMethod('POST')) { |
||
18 | $data = array_values(json_decode($request->getContent(), true)); |
||
19 | $form->submit($data[0]); |
||
20 | if ($form->isSubmitted() && $form->isValid()) { |
||
21 | $csp_report->setDateReceived(new \DateTime()); |
||
22 | $csp_report->setSenderIp($request->getClientIp()); |
||
23 | $csp_report->setUserAgent($request->headers->get('User-Agent')); |
||
24 | $em = $this->get('doctrine.orm.default_entity_manager'); |
||
25 | $em->persist($csp_report); |
||
26 | $em->flush($csp_report); |
||
27 | |||
28 | return new Response($csp_report->getId()); |
||
29 | } else { |
||
30 | return new Response('OOPS'); |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
43 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.