@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace Acelaya\Website\Action\Factory; |
| 3 | 3 | |
| 4 | 4 | use Acelaya\Website\Action\AbstractAction; |
| 5 | -use Doctrine\Common\Cache\Cache; |
|
| 6 | 5 | use Zend\Expressive\Template\TemplateInterface; |
| 7 | 6 | use Zend\ServiceManager\AbstractFactoryInterface; |
| 8 | 7 | use Zend\ServiceManager\ServiceLocatorInterface; |
@@ -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 | */ |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Acelaya\Website\Form; |
| 3 | 3 | |
| 4 | -use ReCaptcha\ReCaptcha; |
|
| 5 | 4 | use Zend\Filter\StringTrim; |
| 6 | 5 | use Zend\Filter\StripTags; |
| 7 | 6 | use Zend\InputFilter\Input; |
@@ -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 | } |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Acelaya\Website\Form; |
| 3 | 3 | |
| 4 | -use ReCaptcha\ReCaptcha; |
|
| 5 | 4 | use Zend\Validator\AbstractValidator; |
| 6 | 5 | use Zend\Validator\Exception; |
| 7 | 6 | |
@@ -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' => [ |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | // Create a ServiceManager from service_manager config and register the merged config as a service |
| 6 | 6 | $config = include __DIR__ . '/config.php'; |
| 7 | -$sm = new ServiceManager(new Config(isset($config['service_manager']) ? $config['service_manager'] : [])); |
|
| 7 | +$sm = new ServiceManager(new Config(isset($config[ 'service_manager' ]) ? $config[ 'service_manager' ] : [ ])); |
|
| 8 | 8 | $sm->setService('config', $config); |
| 9 | 9 | |
| 10 | 10 | // Return the fully configured ServiceManager |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | if (class_exists(Dotenv::class)) { |
| 15 | 15 | $dotenv = new Dotenv(__DIR__ . '/..'); |
| 16 | 16 | $dotenv->load(); |
| 17 | - $dotenv->required('APP_ENV')->allowedValues(['pro', 'dev']); |
|
| 17 | + $dotenv->required('APP_ENV')->allowedValues([ 'pro', 'dev' ]); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Set error reporting |
@@ -76,10 +76,10 @@ |
||
| 76 | 76 | * @param array $routeParams |
| 77 | 77 | * @return bool |
| 78 | 78 | */ |
| 79 | - protected function isResponseCacheable(Response $resp, array $routeParams = []) |
|
| 79 | + protected function isResponseCacheable(Response $resp, array $routeParams = [ ]) |
|
| 80 | 80 | { |
| 81 | 81 | return $resp->getStatusCode() === 200 |
| 82 | - && isset($routeParams['cacheable']) |
|
| 83 | - && $routeParams['cacheable'] === true; |
|
| 82 | + && isset($routeParams[ 'cacheable' ]) |
|
| 83 | + && $routeParams[ 'cacheable' ] === true; |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $params = $matchedRoute->getMatchedParams(); |
| 56 | 56 | |
| 57 | 57 | // Determine the language to use based on the lang parameter |
| 58 | - $lang = isset($params['lang']) ? $params['lang'] : 'en'; |
|
| 58 | + $lang = isset($params[ 'lang' ]) ? $params[ 'lang' ] : 'en'; |
|
| 59 | 59 | $this->translator->setLocale($lang); |
| 60 | 60 | return $out($request, $response); |
| 61 | 61 | } |
@@ -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->container->offsetExists(self::PRG_DATA)) { |
|
| 52 | + if ($request->getMethod() === 'GET' && !$this->container->offsetExists(self::PRG_DATA)) { |
|
| 53 | 53 | return $this->createTemplateResponse($request); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $this->container->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 | } |