validateRequest() public method

public validateRequest ( Psr\Http\Message\ServerRequestInterface $request )
$request Psr\Http\Message\ServerRequestInterface
 public function process(ServerRequestInterface $request, DelegateInterface $delegate) : ResponseInterface
 {
     /* @var \PSR7Session\Session\SessionInterface $session */
     $session = $request->getAttribute(SessionMiddleware::SESSION_ATTRIBUTE);
     // Generate csrf token
     if (!$session->get('csrf')) {
         $session->set('csrf', md5(random_bytes(32)));
     }
     // Generate form and inject csrf token
     $form = new FormFactory($this->template->render('app::contact-form', ['token' => $session->get('csrf')]), $this->inputFilterFactory);
     // Validate form
     $validationResult = $form->validateRequest($request);
     if ($validationResult->isValid()) {
         // Get filter submitted values
         $data = $validationResult->getValues();
         $this->logger->notice('Sending contact mail to {from} <{email}> with subject "{subject}": {body}', $data);
         // Create the message
         $message = new Message();
         $message->setFrom($this->config['from'])->setReplyTo($data['email'], $data['name'])->setTo($this->config['to'])->setSubject('[xtreamwayz-contact] ' . $data['subject'])->setBody($data['body']);
         $this->mailTransport->send($message);
         // Display thank you page
         return new HtmlResponse($this->template->render('app::contact-thank-you'), 200);
     }
     // Display form and inject error messages and submitted values
     return new HtmlResponse($this->template->render('app::contact', ['form' => $form->asString($validationResult)]), 200);
 }