Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function contact(ServerRequestInterface $request, ContactForm $form): ResponseInterface |
||
35 | { |
||
36 | $parameters = [ |
||
37 | 'form' => $form |
||
38 | ]; |
||
39 | $sent = false; |
||
|
|||
40 | |||
41 | if (($request->getMethod() === Method::POST)) { |
||
42 | $sent = true; |
||
43 | |||
44 | if ($form->load($request->getParsedBody()) && $form->validate()) { |
||
45 | $this->mailer->send($form, $request); |
||
46 | } |
||
47 | |||
48 | $parameters['sent'] = $sent; |
||
49 | } |
||
50 | |||
51 | return $this->viewRenderer->withCsrf()->render('form', $parameters); |
||
52 | } |
||
54 |