@@ -39,7 +39,7 @@  | 
                                                    ||
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
| 42 | - * @param $name  | 
                                                        |
| 42 | + * @param string $name  | 
                                                        |
| 43 | 43 | * @param bool|true $required  | 
                                                        
| 44 | 44 | * @return Input  | 
                                                        
| 45 | 45 | */  | 
                                                        
@@ -47,7 +47,7 @@  | 
                                                    ||
| 47 | 47 |      { | 
                                                        
| 48 | 48 | $input = new Input($name);  | 
                                                        
| 49 | 49 | $input->setRequired($required)  | 
                                                        
| 50 | - ->getFilterChain()->attach(new StripTags())  | 
                                                        |
| 50 | + ->getFilterChain()->attach(new StripTags())  | 
                                                        |
| 51 | 51 | ->attach(new StringTrim());  | 
                                                        
| 52 | 52 | return $input;  | 
                                                        
| 53 | 53 | }  | 
                                                        
@@ -6,7 +6,7 @@ discard block  | 
                                                    ||
| 6 | 6 | $home = [  | 
                                                        
| 7 | 7 | 'name' => 'home',  | 
                                                        
| 8 | 8 | 'path' => '(/:lang)/',  | 
                                                        
| 9 | - 'allowed_methods' => ['GET'],  | 
                                                        |
| 9 | + 'allowed_methods' => [ 'GET' ],  | 
                                                        |
| 10 | 10 | 'middleware' => Template::class,  | 
                                                        
| 11 | 11 | 'options' => [  | 
                                                        
| 12 | 12 | 'conditions' => [  | 
                                                        
@@ -43,7 +43,7 @@ discard block  | 
                                                    ||
| 43 | 43 | ArrayUtils::merge($home, [  | 
                                                        
| 44 | 44 | 'name' => 'contact',  | 
                                                        
| 45 | 45 | 'path' => '(/:lang)/contact/',  | 
                                                        
| 46 | - 'allowed_methods' => ['POST'],  | 
                                                        |
| 46 | + 'allowed_methods' => [ 'POST' ],  | 
                                                        |
| 47 | 47 | 'middleware' => Contact::class,  | 
                                                        
| 48 | 48 | 'options' => [  | 
                                                        
| 49 | 49 | 'defaults' => [  | 
                                                        
@@ -18,9 +18,9 @@  | 
                                                    ||
| 18 | 18 | public function getFunctions()  | 
                                                        
| 19 | 19 |      { | 
                                                        
| 20 | 20 | return [  | 
                                                        
| 21 | -            new \Twig_SimpleFunction('translate', [$this, 'translate']), | 
                                                        |
| 22 | -            new \Twig_SimpleFunction('translate_plural', [$this, 'translatePlural']), | 
                                                        |
| 23 | -            new \Twig_SimpleFunction('locale', [$this, 'getLocale']), | 
                                                        |
| 21 | +            new \Twig_SimpleFunction('translate', [ $this, 'translate' ]), | 
                                                        |
| 22 | +            new \Twig_SimpleFunction('translate_plural', [ $this, 'translatePlural' ]), | 
                                                        |
| 23 | +            new \Twig_SimpleFunction('locale', [ $this, 'getLocale' ]), | 
                                                        |
| 24 | 24 | ];  | 
                                                        
| 25 | 25 | }  | 
                                                        
| 26 | 26 | |
@@ -43,10 +43,10 @@  | 
                                                    ||
| 43 | 43 | private function createMessage(array $messageData)  | 
                                                        
| 44 | 44 |      { | 
                                                        
| 45 | 45 | return \Swift_Message::newInstance($this->options->getSubject())  | 
                                                        
| 46 | - ->setTo($this->options->getTo())  | 
                                                        |
| 47 | - ->setFrom($this->options->getFrom())  | 
                                                        |
| 48 | - ->setReplyTo($messageData['email'])  | 
                                                        |
| 49 | - ->setBody($this->composeBody($messageData), 'text/html');  | 
                                                        |
| 46 | + ->setTo($this->options->getTo())  | 
                                                        |
| 47 | + ->setFrom($this->options->getFrom())  | 
                                                        |
| 48 | + ->setReplyTo($messageData['email'])  | 
                                                        |
| 49 | + ->setBody($this->composeBody($messageData), 'text/html');  | 
                                                        |
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
| 52 | 52 | private function composeBody(array $messageData)  | 
                                                        
@@ -45,7 +45,7 @@  | 
                                                    ||
| 45 | 45 | return \Swift_Message::newInstance($this->options->getSubject())  | 
                                                        
| 46 | 46 | ->setTo($this->options->getTo())  | 
                                                        
| 47 | 47 | ->setFrom($this->options->getFrom())  | 
                                                        
| 48 | - ->setReplyTo($messageData['email'])  | 
                                                        |
| 48 | + ->setReplyTo($messageData[ 'email' ])  | 
                                                        |
| 49 | 49 | ->setBody($this->composeBody($messageData), 'text/html');  | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
@@ -8,7 +8,7 @@  | 
                                                    ||
| 8 | 8 |  { | 
                                                        
| 9 | 9 | public function __invoke(ContainerInterface $container)  | 
                                                        
| 10 | 10 |      { | 
                                                        
| 11 | -        $translatorConfig = $container->get('config')['translator']; | 
                                                        |
| 11 | +        $translatorConfig = $container->get('config')[ 'translator' ]; | 
                                                        |
| 12 | 12 | return Translator::factory($translatorConfig);  | 
                                                        
| 13 | 13 | }  | 
                                                        
| 14 | 14 | }  | 
                                                        
@@ -8,7 +8,7 @@  | 
                                                    ||
| 8 | 8 |  { | 
                                                        
| 9 | 9 | public function __invoke(ContainerInterface $container)  | 
                                                        
| 10 | 10 |      { | 
                                                        
| 11 | -        $recaptchaConfig = $container->get('config')['recaptcha']; | 
                                                        |
| 12 | - return new ReCaptcha($recaptchaConfig['private_key']);  | 
                                                        |
| 11 | +        $recaptchaConfig = $container->get('config')[ 'recaptcha' ]; | 
                                                        |
| 12 | + return new ReCaptcha($recaptchaConfig[ 'private_key' ]);  | 
                                                        |
| 13 | 13 | }  | 
                                                        
| 14 | 14 | }  | 
                                                        
@@ -10,8 +10,8 @@  | 
                                                    ||
| 10 | 10 |          $mailConfig = $container->get('config')['mail']; | 
                                                        
| 11 | 11 | $smtp = $mailConfig['smtp'];  | 
                                                        
| 12 | 12 | $transport = \Swift_SmtpTransport::newInstance($smtp['server'], $smtp['port'], $smtp['ssl'])  | 
                                                        
| 13 | - ->setUsername($smtp['username'])  | 
                                                        |
| 14 | - ->setPassword($smtp['password']);  | 
                                                        |
| 13 | + ->setUsername($smtp['username'])  | 
                                                        |
| 14 | + ->setPassword($smtp['password']);  | 
                                                        |
| 15 | 15 | return new \Swift_Mailer($transport);  | 
                                                        
| 16 | 16 | }  | 
                                                        
| 17 | 17 | }  | 
                                                        
@@ -7,11 +7,11 @@  | 
                                                    ||
| 7 | 7 |  { | 
                                                        
| 8 | 8 | public function __invoke(ContainerInterface $container)  | 
                                                        
| 9 | 9 |      { | 
                                                        
| 10 | -        $mailConfig = $container->get('config')['mail']; | 
                                                        |
| 11 | - $smtp = $mailConfig['smtp'];  | 
                                                        |
| 12 | - $transport = \Swift_SmtpTransport::newInstance($smtp['server'], $smtp['port'], $smtp['ssl'])  | 
                                                        |
| 13 | - ->setUsername($smtp['username'])  | 
                                                        |
| 14 | - ->setPassword($smtp['password']);  | 
                                                        |
| 10 | +        $mailConfig = $container->get('config')[ 'mail' ]; | 
                                                        |
| 11 | + $smtp = $mailConfig[ 'smtp' ];  | 
                                                        |
| 12 | + $transport = \Swift_SmtpTransport::newInstance($smtp[ 'server' ], $smtp[ 'port' ], $smtp[ 'ssl' ])  | 
                                                        |
| 13 | + ->setUsername($smtp[ 'username' ])  | 
                                                        |
| 14 | + ->setPassword($smtp[ 'password' ]);  | 
                                                        |
| 15 | 15 | return new \Swift_Mailer($transport);  | 
                                                        
| 16 | 16 | }  | 
                                                        
| 17 | 17 | }  | 
                                                        
@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 | parent::__construct($renderer);  | 
                                                        
| 36 | 36 | $this->contactService = $contactService;  | 
                                                        
| 37 | 37 | $this->contactFilter = $contactFilter;  | 
                                                        
| 38 | - $this->session= $session ?: new Container(__CLASS__);  | 
                                                        |
| 38 | + $this->session = $session ?: new Container(__CLASS__);  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 | public function dispatch(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)  | 
                                                        
| 50 | 50 |      { | 
                                                        
| 51 | 51 | // On GET requests that are not comming from PRG, just return the template  | 
                                                        
| 52 | -        if ($request->getMethod() === 'GET' && ! $this->session->offsetExists(self::PRG_DATA)) { | 
                                                        |
| 52 | +        if ($request->getMethod() === 'GET' && !$this->session->offsetExists(self::PRG_DATA)) { | 
                                                        |
| 53 | 53 | return $this->createTemplateResponse($request);  | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
@@ -65,7 +65,7 @@ discard block  | 
                                                    ||
| 65 | 65 | $this->session->offsetUnset(self::PRG_DATA);  | 
                                                        
| 66 | 66 | $filter = $this->contactFilter;  | 
                                                        
| 67 | 67 | $filter->setData($params);  | 
                                                        
| 68 | -        if (! $filter->isValid()) { | 
                                                        |
| 68 | +        if (!$filter->isValid()) { | 
                                                        |
| 69 | 69 | return $this->createTemplateResponse($request, [  | 
                                                        
| 70 | 70 | 'errors' => $filter->getMessages(),  | 
                                                        
| 71 | 71 | 'currentData' => $params  | 
                                                        
@@ -74,6 +74,6 @@ discard block  | 
                                                    ||
| 74 | 74 | |
| 75 | 75 | // If the form is valid, send the email  | 
                                                        
| 76 | 76 | $result = $this->contactService->send($filter->getValues());  | 
                                                        
| 77 | - return $this->createTemplateResponse($request, $result ? ['success' => true] : ['errors' => []]);  | 
                                                        |
| 77 | + return $this->createTemplateResponse($request, $result ? [ 'success' => true ] : [ 'errors' => [ ] ]);  | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | 79 | }  | 
                                                        
@@ -55,7 +55,7 @@  | 
                                                    ||
| 55 | 55 | * @param Request $request  | 
                                                        
| 56 | 56 | * @param Response $response  | 
                                                        
| 57 | 57 | * @param null|callable $out  | 
                                                        
| 58 | - * @return null|Response  | 
                                                        |
| 58 | + * @return Response  | 
                                                        |
| 59 | 59 | */  | 
                                                        
| 60 | 60 | public function __invoke(Request $request, Response $response, callable $out = null): Response  | 
                                                        
| 61 | 61 |      { | 
                                                        
@@ -63,7 +63,7 @@  | 
                                                    ||
| 63 | 63 | $params = $matchedRoute->getMatchedParams();  | 
                                                        
| 64 | 64 | |
| 65 | 65 | // Determine the language to use based on the lang parameter  | 
                                                        
| 66 | - $lang = $params['lang'] ?? 'en';  | 
                                                        |
| 66 | + $lang = $params[ 'lang' ] ?? 'en';  | 
                                                        |
| 67 | 67 | $this->translator->setLocale($lang);  | 
                                                        
| 68 | 68 | return $out($request, $response);  | 
                                                        
| 69 | 69 | }  |