Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function contact(ServerRequestInterface $request, ContactForm $form): ResponseInterface |
||
29 | { |
||
30 | $parameters = [ |
||
31 | 'form' => $form |
||
32 | ]; |
||
33 | |||
34 | if (($request->getMethod() === Method::POST)) { |
||
35 | $sent = true; |
||
36 | |||
37 | if ($form->load($request->getParsedBody()) && $form->validate()) { |
||
|
|||
38 | $this->mailer->send($form, $request); |
||
39 | } |
||
40 | |||
41 | $parameters['sent'] = $sent; |
||
42 | } |
||
43 | |||
44 | return $this->viewRenderer->withCsrf()->render('form', $parameters); |
||
45 | } |
||
47 |