asString() public method

public asString ( Xtreamwayz\HTMLFormValidator\ValidationResultInterface $result = null )
$result Xtreamwayz\HTMLFormValidator\ValidationResultInterface
 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);
 }
 public function testSetValuesWithConstructor()
 {
     $htmlForm = '
         <form action="/" method="post">
             <input type="text" name="foo" data-reuse-submitted-value="true" />
             <input type="text" name="baz" data-filters="stringtrim" />
         </form>';
     $form = new FormFactory($htmlForm, null, ['foo' => 'bar', 'baz' => 'qux']);
     self::assertContains('<input type="text" name="foo" value="bar">', $form->asString());
     self::assertContains('<input type="text" name="baz" value="qux">', $form->asString());
 }