@@ -20,8 +20,8 @@ |
||
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), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Newsletter\Web\Action; |
4 | 4 | |
5 | 5 | use Psr\Http\Message\ResponseInterface as Response; |
@@ -20,13 +20,13 @@ discard block |
||
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 | } catch (\Exception $e) { |
29 | - return new JsonResponse(['message' => $e->getMessage()], $e->getCode()); |
|
29 | + return new JsonResponse([ 'message' => $e->getMessage() ], $e->getCode()); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Newsletter\Service; |
4 | 4 | |
5 | 5 | use Newsletter\Mapper\NewsletterMapper; |
@@ -19,10 +19,10 @@ discard block |
||
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 | 24 | if (!$current) { |
25 | - return $this->newsletterMapper->insert(['email' => $email]); |
|
25 | + return $this->newsletterMapper->insert([ 'email' => $email ]); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Page; |
4 | 4 | |
5 | 5 | use Zend\ServiceManager\Factory\InvokableFactory; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'page/pagination' => __DIR__ . '/../templates/partial/pagination.php', |
15 | 15 | ], |
16 | 16 | 'paths' => [ |
17 | - 'page' => [__DIR__ . '/../templates/page'], |
|
17 | + 'page' => [ __DIR__ . '/../templates/page' ], |
|
18 | 18 | ], |
19 | 19 | ], |
20 | 20 | |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | 'name' => 'admin.pages', |
33 | 33 | 'path' => '/admin/pages', |
34 | 34 | 'middleware' => Controller\PageController::class, |
35 | - 'allowed_methods' => ['GET'], |
|
35 | + 'allowed_methods' => [ 'GET' ], |
|
36 | 36 | ], |
37 | 37 | [ |
38 | 38 | 'name' => 'admin.pages.action', |
39 | 39 | 'path' => '/admin/pages/:action/:id', |
40 | 40 | 'middleware' => Controller\PageController::class, |
41 | - 'allowed_methods' => ['GET', 'POST'] |
|
41 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
42 | 42 | ] |
43 | 43 | ], |
44 | 44 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Page\Mapper; |
4 | 4 | |
5 | 5 | use Page\Entity\Page; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Page\Controller; |
4 | 4 | |
5 | 5 | use Interop\Container\ContainerInterface; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | public function index(): HtmlResponse |
48 | 48 | { |
49 | 49 | $params = $this->request->getQueryParams(); |
50 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
51 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
50 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
51 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
52 | 52 | $pagination = $this->pageService->getPagination($page, $limit); |
53 | 53 | |
54 | 54 | return new HtmlResponse( |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | ); |
62 | 62 | } |
63 | 63 | |
64 | - public function edit($errors = []): HtmlResponse |
|
64 | + public function edit($errors = [ ]): HtmlResponse |
|
65 | 65 | { |
66 | 66 | $id = $this->request->getAttribute('id'); |
67 | 67 | $page = $this->pageService->getPage($id); |
68 | 68 | |
69 | 69 | if ($this->request->getParsedBody()) { |
70 | 70 | $page = new \Page\Entity\Page(); |
71 | - $page->exchangeArray($this->request->getParsedBody() + (array)$page); |
|
71 | + $page->exchangeArray($this->request->getParsedBody() + (array) $page); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return new HtmlResponse( |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Page\View\Helper; |
4 | 4 | |
5 | 5 | use Page\Service\PageService; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getPage($pageId) |
42 | 42 | { |
43 | - return $this->pageMapper->select(['page_id' => $pageId])->current(); |
|
43 | + return $this->pageMapper->select([ 'page_id' => $pageId ])->current(); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getHomepage() |
59 | 59 | { |
60 | - return $this->pageMapper->select(['is_homepage' => true])->current(); |
|
60 | + return $this->pageMapper->select([ 'is_homepage' => true ])->current(); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $data = $filter->getValues() |
77 | - + ['main_img' => $this->upload->uploadImage($data, 'main_img')]; |
|
78 | - $data['page_id'] = Uuid::uuid1()->toString(); |
|
79 | - $data['page_uuid'] |
|
80 | - = (new MysqlUuid($data['page_id']))->toFormat(new Binary); |
|
77 | + + [ 'main_img' => $this->upload->uploadImage($data, 'main_img') ]; |
|
78 | + $data[ 'page_id' ] = Uuid::uuid1()->toString(); |
|
79 | + $data[ 'page_uuid' ] |
|
80 | + = (new MysqlUuid($data[ 'page_id' ]))->toFormat(new Binary); |
|
81 | 81 | |
82 | - if ($data['is_homepage']) { |
|
83 | - $this->pageMapper->update(['is_homepage' => false]); |
|
82 | + if ($data[ 'is_homepage' ]) { |
|
83 | + $this->pageMapper->update([ 'is_homepage' => false ]); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $this->pageMapper->insert($data); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $data = $filter->getValues() |
102 | - + ['main_img' => $this->upload->uploadImage($data, 'main_img')]; |
|
102 | + + [ 'main_img' => $this->upload->uploadImage($data, 'main_img') ]; |
|
103 | 103 | |
104 | 104 | // We don't want to force user to re-upload image on edit |
105 | - if (!$data['main_img']) { |
|
106 | - unset($data['main_img']); |
|
105 | + if (!$data[ 'main_img' ]) { |
|
106 | + unset($data[ 'main_img' ]); |
|
107 | 107 | } else { |
108 | 108 | $this->upload->deleteFile($page->getMainImg()); |
109 | 109 | } |
110 | 110 | |
111 | - if ($data['is_homepage']) { |
|
112 | - $this->pageMapper->update(['is_homepage' => false]); |
|
111 | + if ($data[ 'is_homepage' ]) { |
|
112 | + $this->pageMapper->update([ 'is_homepage' => false ]); |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->pageMapper->update($data, ['page_id' => $pageId]); |
|
115 | + return $this->pageMapper->update($data, [ 'page_id' => $pageId ]); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function delete($pageId) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $this->upload->deleteFile($page->getMainImg()); |
125 | 125 | |
126 | - return (bool)$this->pageMapper->delete(['page_id' => $pageId]); |
|
126 | + return (bool) $this->pageMapper->delete([ 'page_id' => $pageId ]); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function getForSelect() |