@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Factory\Service; |
5 | 5 | |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __invoke(ContainerInterface $container): PostService |
22 | 22 | { |
23 | - $config = $container->get('config')['upload']; |
|
24 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
23 | + $config = $container->get('config')[ 'upload' ]; |
|
24 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
25 | 25 | |
26 | 26 | return new PostService( |
27 | 27 | $container->get(ArticleMapper::class), |
@@ -19,8 +19,8 @@ |
||
19 | 19 | */ |
20 | 20 | public function __invoke(ContainerInterface $container) |
21 | 21 | { |
22 | - $config = $container->get('config')['upload']; |
|
23 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
22 | + $config = $container->get('config')[ 'upload' ]; |
|
23 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
24 | 24 | |
25 | 25 | return new EventService( |
26 | 26 | $container->get(ArticleMapper::class), |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Factory\Controller; |
5 | 5 |
@@ -15,14 +15,14 @@ |
||
15 | 15 | |
16 | 16 | public function registerNew($email) |
17 | 17 | { |
18 | - if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
18 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
19 | 19 | throw new \Exception('Email is not valid!', 400); |
20 | 20 | } |
21 | 21 | |
22 | - $current = $this->newsletterMapper->select(['email' => $email])->current(); |
|
22 | + $current = $this->newsletterMapper->select([ 'email' => $email ])->current(); |
|
23 | 23 | |
24 | - if(!$current) { |
|
25 | - return $this->newsletterMapper->insert(['email' => $email]); |
|
24 | + if (!$current) { |
|
25 | + return $this->newsletterMapper->insert([ 'email' => $email ]); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Newsletter\Service; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Newsletter\Mapper; |
6 | 6 |
@@ -20,14 +20,14 @@ |
||
20 | 20 | { |
21 | 21 | try { |
22 | 22 | $data = $request->getParsedBody(); |
23 | - $email = isset($data['email']) ? $data['email'] : null; |
|
23 | + $email = isset($data[ 'email' ]) ? $data[ 'email' ] : null; |
|
24 | 24 | |
25 | 25 | $this->newsletterService->registerNew($email); |
26 | 26 | |
27 | - return new JsonResponse(['message' => 'Uspešno ste se prijavili.']); |
|
27 | + return new JsonResponse([ 'message' => 'Uspešno ste se prijavili.' ]); |
|
28 | 28 | } |
29 | - catch(\Exception $e) { |
|
30 | - return new JsonResponse(['message' => $e->getMessage()], $e->getCode()); |
|
29 | + catch (\Exception $e) { |
|
30 | + return new JsonResponse([ 'message' => $e->getMessage() ], $e->getCode()); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | $this->newsletterService->registerNew($email); |
26 | 26 | |
27 | 27 | return new JsonResponse(['message' => 'Uspešno ste se prijavili.']); |
28 | - } |
|
29 | - catch(\Exception $e) { |
|
28 | + } catch(\Exception $e) { |
|
30 | 29 | return new JsonResponse(['message' => $e->getMessage()], $e->getCode()); |
31 | 30 | } |
32 | 31 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Newsletter\Web\Action; |
6 | 6 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | return [ |
10 | 10 | 'templates' => [ |
11 | 11 | 'paths' => [ |
12 | - 'newsletter' => [__DIR__ . '/../templates/newsletter'], |
|
12 | + 'newsletter' => [ __DIR__ . '/../templates/newsletter' ], |
|
13 | 13 | ], |
14 | 14 | ], |
15 | 15 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'name' => 'newsletter-post', |
27 | 27 | 'path' => '/newsletter', |
28 | 28 | 'middleware' => Web\Action\HandlePostAction::class, |
29 | - 'allowed_methods' => ['POST'], |
|
29 | + 'allowed_methods' => [ 'POST' ], |
|
30 | 30 | ], |
31 | 31 | ], |
32 | 32 | ]; |