@@ -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() |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\Mapper; |
4 | 4 | |
5 | 5 | use Zend\Db\Adapter\Adapter; |
@@ -15,28 +15,28 @@ discard block |
||
15 | 15 | $this->adapter = $adapter; |
16 | 16 | } |
17 | 17 | |
18 | - public function selectAll($isActive = null, $filter = []) |
|
18 | + public function selectAll($isActive = null, $filter = [ ]) |
|
19 | 19 | { |
20 | 20 | $select = $this->getSql()->select() |
21 | 21 | ->join( |
22 | 22 | 'category', |
23 | 23 | 'menu.category_uuid = category.category_uuid', |
24 | - ['category_name' => 'name', 'category_slug' => 'slug'], |
|
24 | + [ 'category_name' => 'name', 'category_slug' => 'slug' ], |
|
25 | 25 | 'left' |
26 | - )->join('page', 'page.page_uuid = menu.page_uuid', ['page_id', 'page_slug' => 'slug'], 'left') |
|
27 | - ->order(['order_no' => 'asc']); |
|
26 | + )->join('page', 'page.page_uuid = menu.page_uuid', [ 'page_id', 'page_slug' => 'slug' ], 'left') |
|
27 | + ->order([ 'order_no' => 'asc' ]); |
|
28 | 28 | |
29 | 29 | if ($isActive !== null) { |
30 | - $select->where(['menu.is_active' => $isActive]); |
|
30 | + $select->where([ 'menu.is_active' => $isActive ]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if ($filter) { |
34 | - if (isset($filter['is_in_header'])) { |
|
35 | - $select->where(['is_in_header' => $filter['is_in_header']]); |
|
36 | - } elseif (isset($filter['is_in_footer'])) { |
|
37 | - $select->where(['is_in_footer' => $filter['is_in_footer']]); |
|
38 | - } elseif (isset($filter['is_in_side'])) { |
|
39 | - $select->where(['is_in_side' => $filter['is_in_side']]); |
|
34 | + if (isset($filter[ 'is_in_header' ])) { |
|
35 | + $select->where([ 'is_in_header' => $filter[ 'is_in_header' ] ]); |
|
36 | + } elseif (isset($filter[ 'is_in_footer' ])) { |
|
37 | + $select->where([ 'is_in_footer' => $filter[ 'is_in_footer' ] ]); |
|
38 | + } elseif (isset($filter[ 'is_in_side' ])) { |
|
39 | + $select->where([ 'is_in_side' => $filter[ 'is_in_side' ] ]); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function updateMenuItem($data, $id) |
54 | 54 | { |
55 | - $this->update($data, ['menu_id' => $id]); |
|
55 | + $this->update($data, [ 'menu_id' => $id ]); |
|
56 | 56 | |
57 | 57 | return $id; |
58 | 58 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | public function get($id) |
61 | 61 | { |
62 | 62 | $select = $this->getSql()->select() |
63 | - ->join('page', 'page.page_uuid = menu.page_uuid', ['page_id'], 'left') |
|
64 | - ->join('category', 'category.category_uuid = menu.category_uuid', ['category_id'], 'left') |
|
65 | - ->where(['menu_id' => $id]); |
|
63 | + ->join('page', 'page.page_uuid = menu.page_uuid', [ 'page_id' ], 'left') |
|
64 | + ->join('category', 'category.category_uuid = menu.category_uuid', [ 'category_id' ], 'left') |
|
65 | + ->where([ 'menu_id' => $id ]); |
|
66 | 66 | |
67 | 67 | return $this->selectWith($select)->current(); |
68 | 68 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | public function forSelect() |
71 | 71 | { |
72 | 72 | $select = $this->getSql()->select() |
73 | - ->columns(['menu_id', 'title', 'is_active']) |
|
74 | - ->order(['is_active' => 'desc']); |
|
73 | + ->columns([ 'menu_id', 'title', 'is_active' ]) |
|
74 | + ->order([ 'is_active' => 'desc' ]); |
|
75 | 75 | |
76 | 76 | return $this->selectWith($select); |
77 | 77 | } |