Completed
Push — master ( 191fd3...ec835a )
by Aleksandar
48:41 queued 23:29
created
packages/Menu/src/Mapper/MenuMapper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@  discard block
 block discarded – undo
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
-            ->join('category', 'menu.category_uuid = category.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug'], 'left')
22
-            ->join('articles', 'articles.article_uuid = menu.article_uuid', ['article_id', 'article_slug' => 'slug'], 'left')
23
-            ->order(['order_no' => 'asc']);
21
+            ->join('category', 'menu.category_uuid = category.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ], 'left')
22
+            ->join('articles', 'articles.article_uuid = menu.article_uuid', [ 'article_id', 'article_slug' => 'slug' ], 'left')
23
+            ->order([ 'order_no' => 'asc' ]);
24 24
 
25
-        if($isActive !== null) {
26
-            $select->where(['is_active' => $isActive]);
25
+        if ($isActive !== null) {
26
+            $select->where([ 'is_active' => $isActive ]);
27 27
         }
28 28
 
29
-        if($filter) {
30
-            if(isset($filter['is_in_header'])) {
31
-                $select->where(['is_in_header' => $filter['is_in_header']]);
32
-            } elseif(isset($filter['is_in_footer'])) {
33
-                $select->where(['is_in_footer' => $filter['is_in_footer']]);
34
-            } elseif(isset($filter['is_in_side'])) {
35
-                $select->where(['is_in_side' => $filter['is_in_side']]);
29
+        if ($filter) {
30
+            if (isset($filter[ 'is_in_header' ])) {
31
+                $select->where([ 'is_in_header' => $filter[ 'is_in_header' ] ]);
32
+            } elseif (isset($filter[ 'is_in_footer' ])) {
33
+                $select->where([ 'is_in_footer' => $filter[ 'is_in_footer' ] ]);
34
+            } elseif (isset($filter[ 'is_in_side' ])) {
35
+                $select->where([ 'is_in_side' => $filter[ 'is_in_side' ] ]);
36 36
             }
37 37
         }
38 38
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function updateMenuItem($data, $id)
50 50
     {
51
-        $this->update($data, ['menu_id' => $id]);
51
+        $this->update($data, [ 'menu_id' => $id ]);
52 52
 
53 53
         return $id;
54 54
     }
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     public function get($id)
57 57
     {
58 58
         $select = $this->getSql()->select()
59
-            ->join('articles', 'articles.article_uuid = menu.article_uuid', ['article_id'], 'left')
60
-            ->join('category', 'category.category_uuid = menu.category_uuid', ['category_id'], 'left')
61
-            ->where(['menu_id' => $id]);
59
+            ->join('articles', 'articles.article_uuid = menu.article_uuid', [ 'article_id' ], 'left')
60
+            ->join('category', 'category.category_uuid = menu.category_uuid', [ 'category_id' ], 'left')
61
+            ->where([ 'menu_id' => $id ]);
62 62
 
63 63
         return $this->selectWith($select)->current();
64 64
     }
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     public function forSelect()
67 67
     {
68 68
         $select = $this->getSql()->select()
69
-            ->columns(['menu_id', 'title', 'is_active'])
70
-            ->order(['is_active' => 'desc']);
69
+            ->columns([ 'menu_id', 'title', 'is_active' ])
70
+            ->order([ 'is_active' => 'desc' ]);
71 71
 
72 72
         return $this->selectWith($select);
73 73
     }
Please login to merge, or discard this patch.
packages/Menu/src/ConfigProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
                     'partial/menu-level' => __DIR__ . '/../templates/partial/menu-level.phtml',
13 13
                 ],
14 14
                 'paths' => [
15
-                    'menu' => [__DIR__ . '/../templates/menu'],
15
+                    'menu' => [ __DIR__ . '/../templates/menu' ],
16 16
                 ],
17 17
             ],
18 18
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
                     'name'            => 'admin.menu',
34 34
                     'path'            => '/admin/menu',
35 35
                     'middleware'      => Controller\IndexController::class,
36
-                    'allowed_methods' => ['GET'],
36
+                    'allowed_methods' => [ 'GET' ],
37 37
                 ],
38 38
                 [
39 39
                     'name'            => 'admin.menu.action',
40 40
                     'path'            => '/admin/menu/:action/:id',
41 41
                     'middleware'      => Controller\IndexController::class,
42
-                    'allowed_methods' => ['GET', 'POST'],
42
+                    'allowed_methods' => [ 'GET', 'POST' ],
43 43
                 ],
44 44
             ],
45 45
 
Please login to merge, or discard this patch.
packages/Page/src/Service/PageServiceFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 {
12 12
     public function __invoke(ContainerInterface $container)
13 13
     {
14
-        $config = $container->get('config')['upload'];
15
-        $upload = new Upload($config['public_path'], $config['non_public_path']);
14
+        $config = $container->get('config')[ 'upload' ];
15
+        $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]);
16 16
 
17 17
         return new PageService(
18 18
             $container->get(PageMapper::class),
Please login to merge, or discard this patch.
packages/Page/src/Controller/PageController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public function index(): HtmlResponse
40 40
     {
41 41
         $params     = $this->request->getQueryParams();
42
-        $page       = isset($params['page']) ? $params['page'] : 1;
43
-        $limit      = isset($params['limit']) ? $params['limit'] : 15;
42
+        $page       = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
43
+        $limit      = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
44 44
         $pagination = $this->pageService->getPagination($page, $limit);
45 45
 
46 46
         return new HtmlResponse($this->template->render('page::index', [
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         ]));
50 50
     }
51 51
 
52
-    public function edit($errors = []): HtmlResponse
52
+    public function edit($errors = [ ]): HtmlResponse
53 53
     {
54 54
         $id   = $this->request->getAttribute('id');
55 55
         $page = $this->pageService->getPage($id);
56 56
 
57
-        if($this->request->getParsedBody()) {
57
+        if ($this->request->getParsedBody()) {
58 58
             $page = new \Page\Entity\Page();
59
-            $page->exchangeArray($this->request->getParsedBody() + (array)$page);
59
+            $page->exchangeArray($this->request->getParsedBody() + (array) $page);
60 60
         }
61 61
 
62 62
         return new HtmlResponse($this->template->render('page::edit', [
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
         try {
72 72
             $pageId = $this->request->getAttribute('id');
73 73
             $data   = $this->request->getParsedBody();
74
-            $data   += (new Request())->getFiles()->toArray();
74
+            $data += (new Request())->getFiles()->toArray();
75 75
 
76
-            if($pageId) {
76
+            if ($pageId) {
77 77
                 $this->pageService->updatePage($data, $pageId);
78 78
             }
79 79
             else {
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 
83 83
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
84 84
         }
85
-        catch(FilterException $fe) {
85
+        catch (FilterException $fe) {
86 86
             return $this->edit($fe->getArrayMessages());
87 87
         }
88
-        catch(\Exception $e) {
88
+        catch (\Exception $e) {
89 89
             throw $e;
90 90
         }
91 91
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
100 100
         }
101
-        catch(\Exception $e) {
101
+        catch (\Exception $e) {
102 102
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
packages/Page/src/Filter/PageFilter.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,65 +17,65 @@
 block discarded – undo
17 17
         $inputFilter->add([
18 18
             'name'       => 'title',
19 19
             'required'   => true,
20
-            'filters'    => [['name' => 'StringTrim']],
20
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
21 21
             'validators' => [
22
-                ['name' => 'NotEmpty'],
23
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
22
+                [ 'name' => 'NotEmpty' ],
23
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
24 24
             ],
25 25
         ]);
26 26
 
27 27
         $inputFilter->add([
28 28
             'name'       => 'slug',
29 29
             'required'   => true,
30
-            'filters'    => [['name' => 'StringTrim']],
30
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
31 31
             'validators' => [
32
-                ['name' => 'NotEmpty'],
33
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
32
+                [ 'name' => 'NotEmpty' ],
33
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
34 34
             ],
35 35
         ]);
36 36
 
37 37
         $inputFilter->add([
38 38
             'name'       => 'body',
39 39
             'required'   => true,
40
-            'filters'    => [['name' => 'StringTrim']],
40
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
41 41
             'validators' => [
42
-                ['name' => 'NotEmpty'],
43
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]],
42
+                [ 'name' => 'NotEmpty' ],
43
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100000 ] ],
44 44
             ],
45 45
         ]);
46 46
 
47 47
         $inputFilter->add([
48 48
             'name'       => 'description',
49 49
             'required'   => true,
50
-            'filters'    => [['name' => 'StringTrim']],
50
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
51 51
             'validators' => [
52
-                ['name' => 'NotEmpty'],
53
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]],
52
+                [ 'name' => 'NotEmpty' ],
53
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 50000 ] ],
54 54
             ],
55 55
         ]);
56 56
 
57 57
         $inputFilter->add([
58 58
             'name'     => 'has_layout',
59 59
             'required' => false,
60
-            'filters'  => [['name' => 'Boolean']],
60
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
61 61
         ]);
62 62
 
63 63
         $inputFilter->add([
64 64
             'name'     => 'is_homepage',
65 65
             'required' => false,
66
-            'filters'  => [['name' => 'Boolean']],
66
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
67 67
         ]);
68 68
 
69 69
         $inputFilter->add([
70 70
             'name'     => 'is_active',
71 71
             'required' => false,
72
-            'filters'  => [['name' => 'Boolean']],
72
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
73 73
         ]);
74 74
 
75 75
         $inputFilter->add([
76 76
             'name'     => 'is_wysiwyg_editor',
77 77
             'required' => false,
78
-            'filters'  => [['name' => 'Boolean']],
78
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
79 79
         ]);
80 80
 
81 81
         return $inputFilter;
Please login to merge, or discard this patch.
packages/Page/src/ConfigProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         ];
Please login to merge, or discard this patch.
packages/Page/src/Entity/Page.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function getDescription($limit = null)
112 112
     {
113
-        if(!$limit) {
113
+        if (!$limit) {
114 114
             return $this->description;
115 115
         }
116 116
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getCreatedAt($format = null)
167 167
     {
168
-        if(!$format) {
168
+        if (!$format) {
169 169
             return $this->created_at;
170 170
         }
171 171
 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @param array $data
185 185
      */
186
-    public function exchangeArray($data = [])
186
+    public function exchangeArray($data = [ ])
187 187
     {
188
-        foreach(array_keys(get_object_vars($this)) as $property) {
189
-            $this->{$property} = isset($data[$property]) ? $data[$property] : null;
188
+        foreach (array_keys(get_object_vars($this)) as $property) {
189
+            $this->{$property} = isset($data[ $property ]) ? $data[ $property ] : null;
190 190
         }
191 191
     }
192 192
 
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
     public function getArrayCopy()
195 195
     {
196 196
         return [
197
-            'page_uuid'         => (binary)$this->page_uuid,
198
-            'page_id'           => (string)$this->page_id,
199
-            'title'             => (string)$this->title,
200
-            'body'              => (string)$this->body,
201
-            'description'       => (string)$this->description,
202
-            'main_img'          => (string)$this->main_img,
203
-            'has_layout'        => (boolean)$this->has_layout,
204
-            'is_homepage'       => (boolean)$this->is_homepage,
205
-            'is_active'         => (boolean)$this->is_active,
206
-            'is_wysiwyg_editor' => (boolean)$this->is_wysiwyg_editor,
207
-            'created_at'        => (string)$this->created_at,
208
-            'slug'              => (string)$this->slug
197
+            'page_uuid'         => (binary) $this->page_uuid,
198
+            'page_id'           => (string) $this->page_id,
199
+            'title'             => (string) $this->title,
200
+            'body'              => (string) $this->body,
201
+            'description'       => (string) $this->description,
202
+            'main_img'          => (string) $this->main_img,
203
+            'has_layout'        => (boolean) $this->has_layout,
204
+            'is_homepage'       => (boolean) $this->is_homepage,
205
+            'is_active'         => (boolean) $this->is_active,
206
+            'is_wysiwyg_editor' => (boolean) $this->is_wysiwyg_editor,
207
+            'created_at'        => (string) $this->created_at,
208
+            'slug'              => (string) $this->slug
209 209
         ];
210 210
     }
211 211
 
Please login to merge, or discard this patch.
packages/Page/templates/partial/pagination.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         </div>
8 8
     </div>
9 9
     <div class="col-sm-7">
10
-        <?php if($this->pageCount > 1): ?>
10
+        <?php if ($this->pageCount > 1): ?>
11 11
             <div class="pull-right">
12 12
                 <ul class="pagination" style="margin:0px;">
13 13
                     <!-- Previous page link -->
14
-                    <?php if(isset($this->previous)): ?>
14
+                    <?php if (isset($this->previous)): ?>
15 15
                         <li>
16
-                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->previous; ?>">
16
+                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->previous; ?>">
17 17
                                 <span class="glyphicon glyphicon-chevron-left"></span>
18 18
                             </a>
19 19
                         </li>
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
                     <?php endif; ?>
27 27
 
28 28
                     <!-- Numbered page links -->
29
-                    <?php foreach($this->pagesInRange as $page): ?>
30
-                        <?php if($page != $this->current): ?>
29
+                    <?php foreach ($this->pagesInRange as $page): ?>
30
+                        <?php if ($page != $this->current): ?>
31 31
                             <li>
32
-                                <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $page; ?>">
32
+                                <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $page; ?>">
33 33
                                     <?php echo $page; ?>
34 34
                                 </a>
35 35
                             </li>
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                     <?php endforeach; ?>
42 42
 
43 43
                     <!-- Next page link -->
44
-                    <?php if(isset($this->next)): ?>
44
+                    <?php if (isset($this->next)): ?>
45 45
                         <li>
46
-                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->next; ?>">
46
+                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->next; ?>">
47 47
                                 <span class="glyphicon glyphicon-chevron-right"></span>
48 48
                             </a>
49 49
                         </li>
Please login to merge, or discard this patch.
packages/Admin/src/Controller/AuthController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Admin\Controller;
5 5
 
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function login($error = false): \Psr\Http\Message\ResponseInterface
62 62
     {
63
-        if($this->session->getStorage()->user) {
63
+        if ($this->session->getStorage()->user) {
64 64
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
65 65
         }
66 66
 
67
-        return new HtmlResponse($this->template->render('admin::login', ['layout' => false, 'error' => $error]));
67
+        return new HtmlResponse($this->template->render('admin::login', [ 'layout' => false, 'error' => $error ]));
68 68
     }
69 69
 
70 70
     /**
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function loginHandle(): \Psr\Http\Message\ResponseInterface
76 76
     {
77
-        if($this->session->getStorage()->user) {
77
+        if ($this->session->getStorage()->user) {
78 78
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
79 79
         }
80 80
 
81 81
         $data     = $this->request->getParsedBody();
82
-        $email    = isset($data['email']) ? $data['email'] : null;
83
-        $password = isset($data['password']) ? $data['password'] : null;
82
+        $email    = isset($data[ 'email' ]) ? $data[ 'email' ] : null;
83
+        $password = isset($data[ 'password' ]) ? $data[ 'password' ] : null;
84 84
 
85 85
         try {
86 86
             $this->session->getStorage()->user = $this->adminUserService->loginUser($email, $password);
87 87
 
88 88
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
89 89
         }
90
-        catch(\Exception $e) {
90
+        catch (\Exception $e) {
91 91
             return $this->login($e->getMessage());
92 92
 
93 93
             //@todo set $e->getMessage() to flash messanger and print messages in next page
Please login to merge, or discard this patch.