Completed
Pull Request — master (#82)
by
unknown
19:58
created
src/Web/Factory/Action/VideoActionFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Web\Factory\Action;
6 6
 
Please login to merge, or discard this patch.
src/Menu/src/View/Helper/MenuUrlHelper.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@
 block discarded – undo
33 33
      */
34 34
     public function __invoke($menuItem)
35 35
     {
36
-        if($menuItem['href']) {
37
-            return strpos($menuItem['href'], 'http') === 0 ? $menuItem['href'] : '/' . $menuItem['href'];
36
+        if ($menuItem[ 'href' ]) {
37
+            return strpos($menuItem[ 'href' ], 'http') === 0 ? $menuItem[ 'href' ] : '/' . $menuItem[ 'href' ];
38 38
         }
39
-        elseif($menuItem['article_slug']) {
39
+        elseif ($menuItem[ 'article_slug' ]) {
40 40
             // @todo refactor - break categories into single category per article...
41
-            $category = $this->postService->getCategories($menuItem['article_id'])->current();
41
+            $category = $this->postService->getCategories($menuItem[ 'article_id' ])->current();
42 42
 
43
-            if($category){
44
-                $params = ['segment_1' => $category->slug, 'segment_2' => $menuItem['article_slug']];
43
+            if ($category) {
44
+                $params = [ 'segment_1' => $category->slug, 'segment_2' => $menuItem[ 'article_slug' ] ];
45 45
             }
46
-            else{
47
-                $params = ['segment_1' => $menuItem['article_slug']];
46
+            else {
47
+                $params = [ 'segment_1' => $menuItem[ 'article_slug' ] ];
48 48
             }
49 49
 
50 50
             return $this->url->__invoke('post', $params);
51 51
         }
52
-        elseif($menuItem['category_slug']) {
53
-            return $this->url->__invoke('category', ['category' => $menuItem['category_slug']]);
52
+        elseif ($menuItem[ 'category_slug' ]) {
53
+            return $this->url->__invoke('category', [ 'category' => $menuItem[ 'category_slug' ] ]);
54 54
         }
55 55
         else {
56 56
             return '#';
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,24 +35,20 @@
 block discarded – undo
35 35
     {
36 36
         if($menuItem['href']) {
37 37
             return strpos($menuItem['href'], 'http') === 0 ? $menuItem['href'] : '/' . $menuItem['href'];
38
-        }
39
-        elseif($menuItem['article_slug']) {
38
+        } elseif($menuItem['article_slug']) {
40 39
             // @todo refactor - break categories into single category per article...
41 40
             $category = $this->postService->getCategories($menuItem['article_id'])->current();
42 41
 
43 42
             if($category){
44 43
                 $params = ['segment_1' => $category->slug, 'segment_2' => $menuItem['article_slug']];
45
-            }
46
-            else{
44
+            } else{
47 45
                 $params = ['segment_1' => $menuItem['article_slug']];
48 46
             }
49 47
 
50 48
             return $this->url->__invoke('post', $params);
51
-        }
52
-        elseif($menuItem['category_slug']) {
49
+        } elseif($menuItem['category_slug']) {
53 50
             return $this->url->__invoke('category', ['category' => $menuItem['category_slug']]);
54
-        }
55
-        else {
51
+        } else {
56 52
             return '#';
57 53
         }
58 54
     }
Please login to merge, or discard this patch.
src/Web/Action/VideoAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Web\Action;
6 6
 
Please login to merge, or discard this patch.
src/Article/src/Service/EventService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -63,6 +63,9 @@
 block discarded – undo
63 63
         return $this->getPagination($select, $page, $limit);
64 64
     }
65 65
 
66
+    /**
67
+     * @param integer $limit
68
+     */
66 69
     public function fetchLatest($limit)
67 70
     {
68 71
         return $this->articleEventsMapper->getLatest($limit);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
84 84
         $eventFilter   = $this->eventFilter->getInputFilter()->setData($data);
85 85
 
86
-        if(!$articleFilter->isValid() || !$eventFilter->isValid()) {
86
+        if (!$articleFilter->isValid() || !$eventFilter->isValid()) {
87 87
             throw new FilterException($articleFilter->getMessages() + $eventFilter->getMessages());
88 88
         }
89 89
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
                 'article_uuid'    => $uuId
98 98
             ];
99 99
 
100
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
101
-        unset($article['category_id']);
100
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
101
+        unset($article[ 'category_id' ]);
102 102
 
103 103
         $event = $eventFilter->getValues() + [
104 104
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
@@ -116,41 +116,41 @@  discard block
 block discarded – undo
116 116
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
117 117
         $eventFilter   = $this->eventFilter->getInputFilter()->setData($data);
118 118
 
119
-        if(!$articleFilter->isValid() || !$eventFilter->isValid()) {
119
+        if (!$articleFilter->isValid() || !$eventFilter->isValid()) {
120 120
             throw new FilterException($articleFilter->getMessages() + $eventFilter->getMessages());
121 121
         }
122 122
 
123
-        $article = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid];
123
+        $article = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ];
124 124
         $event   = $eventFilter->getValues() + [
125 125
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
126 126
                 'main_img'     => $this->upload->uploadImage($data, 'main_img')
127 127
             ];
128 128
 
129
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
130
-        unset($article['category_id']);
129
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
130
+        unset($article[ 'category_id' ]);
131 131
 
132 132
         // We dont want to force user to re-upload image on edit
133
-        if(!$event['featured_img']) {
134
-            unset($event['featured_img']);
133
+        if (!$event[ 'featured_img' ]) {
134
+            unset($event[ 'featured_img' ]);
135 135
         }
136 136
 
137
-        if(!$event['main_img']) {
138
-            unset($event['main_img']);
137
+        if (!$event[ 'main_img' ]) {
138
+            unset($event[ 'main_img' ]);
139 139
         }
140 140
 
141
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
142
-        $this->articleEventsMapper->update($event, ['article_uuid' => $article['article_uuid']]);
141
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
142
+        $this->articleEventsMapper->update($event, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
143 143
     }
144 144
 
145 145
     public function deleteArticle($id)
146 146
     {
147 147
         $event = $this->articleEventsMapper->get($id);
148 148
 
149
-        if(!$event) {
149
+        if (!$event) {
150 150
             throw new \Exception('Article not found!');
151 151
         }
152 152
 
153
-        $this->articleEventsMapper->delete(['article_uuid' => $event->article_uuid]);
153
+        $this->articleEventsMapper->delete([ 'article_uuid' => $event->article_uuid ]);
154 154
         $this->delete($event->article_uuid);
155 155
     }
156 156
 
Please login to merge, or discard this patch.
src/Article/src/Service/PostService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -203,6 +203,9 @@
 block discarded – undo
203 203
         return $this->articleMapper->getCategories($articleId);
204 204
     }
205 205
 
206
+    /**
207
+     * @param integer $limit
208
+     */
206 209
     public function getLatestWeb($limit)
207 210
     {
208 211
         return $this->articlePostsMapper->getLatest($limit);
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Article\Service;
6 6
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
91 91
         $postFilter    = $this->postFilter->getInputFilter()->setData($data);
92 92
 
93
-        if(!$articleFilter->isValid() || !$postFilter->isValid()) {
93
+        if (!$articleFilter->isValid() || !$postFilter->isValid()) {
94 94
             throw new FilterException($articleFilter->getMessages() + $postFilter->getMessages());
95 95
         }
96 96
 
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
                 'article_uuid'    => $uuId
105 105
             ];
106 106
 
107
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
108
-        unset($article['category_id']);
107
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
108
+        unset($article[ 'category_id' ]);
109 109
 
110 110
         $post = $postFilter->getValues() + [
111 111
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
112 112
                 'main_img'     => $this->upload->uploadImage($data, 'main_img'),
113
-                'article_uuid' => $article['article_uuid']
113
+                'article_uuid' => $article[ 'article_uuid' ]
114 114
             ];
115 115
 
116
-        if($post['is_homepage']) {
117
-            $this->articlePostsMapper->update(['is_homepage' => false]);
116
+        if ($post[ 'is_homepage' ]) {
117
+            $this->articlePostsMapper->update([ 'is_homepage' => false ]);
118 118
         }
119 119
 
120 120
         $this->articleMapper->insert($article);
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
128 128
         $postFilter    = $this->postFilter->getInputFilter()->setData($data);
129 129
 
130
-        if(!$articleFilter->isValid() || !$postFilter->isValid()) {
130
+        if (!$articleFilter->isValid() || !$postFilter->isValid()) {
131 131
             throw new FilterException($articleFilter->getMessages() + $postFilter->getMessages());
132 132
         }
133 133
 
134
-        $article = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid];
134
+        $article = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ];
135 135
         $post    = $postFilter->getValues() + [
136 136
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
137 137
                 'main_img'     => $this->upload->uploadImage($data, 'main_img')
138 138
             ];
139 139
 
140
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
141
-        unset($article['category_id']);
140
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
141
+        unset($article[ 'category_id' ]);
142 142
 
143 143
         // We dont want to force user to re-upload image on edit
144
-        if(!$post['featured_img']) {
145
-            unset($post['featured_img']);
144
+        if (!$post[ 'featured_img' ]) {
145
+            unset($post[ 'featured_img' ]);
146 146
         }
147 147
 
148
-        if(!$post['main_img']) {
149
-            unset($post['main_img']);
148
+        if (!$post[ 'main_img' ]) {
149
+            unset($post[ 'main_img' ]);
150 150
         }
151 151
 
152
-        if($post['is_homepage']) {
153
-            $this->articlePostsMapper->update(['is_homepage' => false]);
152
+        if ($post[ 'is_homepage' ]) {
153
+            $this->articlePostsMapper->update([ 'is_homepage' => false ]);
154 154
         }
155 155
 
156
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
157
-        $this->articlePostsMapper->update($post, ['article_uuid' => $article['article_uuid']]);
156
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
157
+        $this->articlePostsMapper->update($post, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
158 158
     }
159 159
 
160 160
     public function deleteArticle($id)
161 161
     {
162 162
         $post = $this->articlePostsMapper->get($id);
163 163
 
164
-        if(!$post) {
164
+        if (!$post) {
165 165
             throw new \Exception('Article not found!');
166 166
         }
167 167
 
168
-        $this->articlePostsMapper->delete(['article_uuid' => $post->article_uuid]);
168
+        $this->articlePostsMapper->delete([ 'article_uuid' => $post->article_uuid ]);
169 169
         $this->delete($post->article_uuid);
170 170
     }
171 171
 
Please login to merge, or discard this patch.
src/Article/src/Service/VideoService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -91,6 +91,9 @@
 block discarded – undo
91 91
         return $this->getPagination($select, $page, $limit);
92 92
     }
93 93
 
94
+    /**
95
+     * @param integer $limit
96
+     */
94 97
     public function fetchLatest($limit)
95 98
     {
96 99
         return $this->articleVideosMapper->getLatest($limit);
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Article\Service;
6 6
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
112 112
         $videosFilter  = $this->videosFilter->getInputFilter()->setData($data);
113 113
 
114
-        if(!$articleFilter->isValid() || !$videosFilter->isValid()) {
114
+        if (!$articleFilter->isValid() || !$videosFilter->isValid()) {
115 115
             throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages());
116 116
         }
117 117
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
                 'article_uuid'    => $uuId
125 125
             ];
126 126
 
127
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
128
-        unset($article['category_id']);
127
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
128
+        unset($article[ 'category_id' ]);
129 129
 
130 130
         $videos = $videosFilter->getValues() + [
131 131
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
@@ -143,40 +143,40 @@  discard block
 block discarded – undo
143 143
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
144 144
         $videosFilter  = $this->videosFilter->getInputFilter()->setData($data);
145 145
 
146
-        if(!$articleFilter->isValid() || !$videosFilter->isValid()) {
146
+        if (!$articleFilter->isValid() || !$videosFilter->isValid()) {
147 147
             throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages());
148 148
         }
149 149
 
150
-        $article                  = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid];
151
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
152
-        unset($article['category_id']);
150
+        $article                  = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ];
151
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
152
+        unset($article[ 'category_id' ]);
153 153
         $videos = $videosFilter->getValues() + [
154 154
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
155 155
                 'main_img'     => $this->upload->uploadImage($data, 'main_img')
156 156
             ];
157 157
 
158 158
         // We dont want to force user to re-upload image on edit
159
-        if(!$videos['featured_img']) {
160
-            unset($videos['featured_img']);
159
+        if (!$videos[ 'featured_img' ]) {
160
+            unset($videos[ 'featured_img' ]);
161 161
         }
162 162
 
163
-        if(!$videos['main_img']) {
164
-            unset($videos['main_img']);
163
+        if (!$videos[ 'main_img' ]) {
164
+            unset($videos[ 'main_img' ]);
165 165
         }
166 166
 
167
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
168
-        $this->articleVideosMapper->update($videos, ['article_uuid' => $article['article_uuid']]);
167
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
168
+        $this->articleVideosMapper->update($videos, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
169 169
     }
170 170
 
171 171
     public function deleteArticle($id)
172 172
     {
173 173
         $video = $this->articleVideosMapper->get($id);
174 174
 
175
-        if(!$video) {
175
+        if (!$video) {
176 176
             throw new \Exception('Article not found!');
177 177
         }
178 178
 
179
-        $this->articleVideosMapper->delete(['article_uuid' => $video->article_uuid]);
179
+        $this->articleVideosMapper->delete([ 'article_uuid' => $video->article_uuid ]);
180 180
         $this->delete($video->article_uuid);
181 181
     }
182 182
 
Please login to merge, or discard this patch.
src/Core/Mapper/AdminUsersMapper.php 2 patches
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@  discard block
 block discarded – undo
31 31
         $this->adapter = $adapter;
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $id
36
+     */
34 37
     public function get($id)
35 38
     {
36 39
         return $this->select(['admin_user_id' => $id])->current();
@@ -40,7 +43,7 @@  discard block
 block discarded – undo
40 43
      * Get admin user by email.
41 44
      *
42 45
      * @param  string $email email
43
-     * @return array|\ArrayObject|null
46
+     * @return string
44 47
      */
45 48
     public function getByEmail(string $email)
46 49
     {
@@ -50,7 +53,6 @@  discard block
 block discarded – undo
50 53
     /**
51 54
      * Updates login data.
52 55
      *
53
-     * @param  string $uuid admin user id
54 56
      * @return int number of affected rows
55 57
      */
56 58
     public function updateLogin(string $userId): int
@@ -58,6 +60,9 @@  discard block
 block discarded – undo
58 60
         return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]);
59 61
     }
60 62
 
63
+    /**
64
+     * @param string $userId
65
+     */
61 66
     public function getPaginationSelect($userId)
62 67
     {
63 68
         $select = $this->getSql()->select()->order(['created_at' => 'desc']);
@@ -67,6 +72,9 @@  discard block
 block discarded – undo
67 72
         return $select;
68 73
     }
69 74
 
75
+    /**
76
+     * @param integer $limit
77
+     */
70 78
     public function getRandom($limit)
71 79
     {
72 80
         $select = $this->getSql()->select()
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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 Core\Mapper;
5 5
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function get($id)
35 35
     {
36
-        return $this->select(['admin_user_id' => $id])->current();
36
+        return $this->select([ 'admin_user_id' => $id ])->current();
37 37
     }
38 38
 
39 39
     /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function getByEmail(string $email)
46 46
     {
47
-        return $this->select(['email' => $email])->current();
47
+        return $this->select([ 'email' => $email ])->current();
48 48
     }
49 49
 
50 50
     /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function updateLogin(string $userId): int
57 57
     {
58
-        return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]);
58
+        return $this->update([ 'last_login' => date('Y-m-d H:i:s') ], [ 'admin_user_id' => $userId ]);
59 59
     }
60 60
 
61 61
     public function getPaginationSelect($userId)
62 62
     {
63
-        $select = $this->getSql()->select()->order(['created_at' => 'desc']);
63
+        $select = $this->getSql()->select()->order([ 'created_at' => 'desc' ]);
64 64
 
65 65
         $select->where->notEqualTo('admin_user_id', $userId);
66 66
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function getRandom($limit)
71 71
     {
72 72
         $select = $this->getSql()->select()
73
-            ->where(['status' => 1])
73
+            ->where([ 'status' => 1 ])
74 74
             ->order(new Expression('rand()'))
75 75
             ->limit($limit);
76 76
 
Please login to merge, or discard this patch.
src/Web/ConfigProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
                     'article/pagination' => 'templates/partial/pagination.phtml',
14 14
                 ],
15 15
                 'paths' => [
16
-                    'templates' => ['templates'],
17
-                    'web'       => ['templates/web'],
16
+                    'templates' => [ 'templates' ],
17
+                    'web'       => [ 'templates/web' ],
18 18
                 ],
19 19
             ],
20 20
 
Please login to merge, or discard this patch.
src/Web/Action/HomeAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Web\Action;
6 6
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function __invoke(Request $request, Response $response, callable $next = null): HtmlResponse
47 47
     {
48 48
         // Set custom html from view file
49
-        return new HtmlResponse($this->template->render('web::home', ['layout' => 'layout/web']));
49
+        return new HtmlResponse($this->template->render('web::home', [ 'layout' => 'layout/web' ]));
50 50
 
51 51
         //$article = $this->postService->getHomepage();
52 52
         //
Please login to merge, or discard this patch.