Completed
Push — master ( 1a7910...41e170 )
by Aleksandar
126:10 queued 78:50
created
packages/Article/src/Controller/VideoController.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 Article\Controller;
5 5
 
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
     public function index(): HtmlResponse
60 60
     {
61 61
         $params = $this->request->getQueryParams();
62
-        $page   = isset($params['page']) ? $params['page'] : 1;
63
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
62
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
63
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
64 64
         $videos = $this->videoService->fetchAllArticles($page, $limit);
65 65
 
66 66
         return new HtmlResponse($this->template->render('article::video/index',
67
-            ['list' => $videos, 'layout' => 'layout/admin'])
67
+            [ 'list' => $videos, 'layout' => 'layout/admin' ])
68 68
         );
69 69
     }
70 70
 
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return \Psr\Http\Message\ResponseInterface
75 75
      */
76
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
76
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
77 77
     {
78 78
         $id         = $this->request->getAttribute('id');
79 79
         $video      = $this->videoService->fetchSingleArticle($id);
80 80
         $categories = $this->categoryService->getAll(ArticleType::VIDEO);
81 81
 
82 82
         if ($this->request->getParsedBody()) {
83
-            $video             = (object)($this->request->getParsedBody() + (array)$video);
83
+            $video             = (object) ($this->request->getParsedBody() + (array) $video);
84 84
             $video->article_id = $id;
85 85
         }
86 86
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         }
142 142
 
143 143
         return $this->response->withStatus(302)->withHeader('Location',
144
-            $this->router->generateUri('admin.videos', ['action' => 'index'])
144
+            $this->router->generateUri('admin.videos', [ 'action' => 'index' ])
145 145
         );
146 146
     }
147 147
 }
Please login to merge, or discard this patch.
packages/Article/src/Controller/EventController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@
 block discarded – undo
46 46
     public function index(): \Psr\Http\Message\ResponseInterface
47 47
     {
48 48
         $params = $this->request->getQueryParams();
49
-        $page = isset($params['page']) ? $params['page'] : 1;
50
-        $limit = isset($params['limit']) ? $params['limit'] : 15;
49
+        $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
50
+        $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
51 51
         $events = $this->eventService->fetchAllArticles($page, $limit);
52 52
 
53 53
         return new HtmlResponse($this->template->render(
54 54
             'article::event/index',
55
-            ['list' => $events, 'layout' => 'layout/admin'])
55
+            [ 'list' => $events, 'layout' => 'layout/admin' ])
56 56
         );
57 57
     }
58 58
 
59
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
59
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
60 60
     {
61 61
         $id = $this->request->getAttribute('id');
62 62
         $event = $this->eventService->fetchSingleArticle($id);
63 63
         $categories = $this->categoryService->getAll(ArticleType::EVENT);
64 64
 
65 65
         if ($this->request->getParsedBody()) {
66
-            $event = (object)($this->request->getParsedBody() + (array)$event);
66
+            $event = (object) ($this->request->getParsedBody() + (array) $event);
67 67
             $event->article_id = $id;
68 68
         }
69 69
 
Please login to merge, or discard this patch.
packages/Article/src/Controller/DiscussionController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
     public function index(): \Psr\Http\Message\ResponseInterface
71 71
     {
72 72
         $params = $this->request->getQueryParams();
73
-        $page = isset($params['page']) ? $params['page'] : 1;
74
-        $limit = isset($params['limit']) ? $params['limit'] : 15;
73
+        $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
74
+        $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
75 75
 
76 76
         $discussions = $this->discussionService->fetchAllArticles($page, $limit);
77 77
 
78 78
         return new HtmlResponse($this->template->render(
79 79
             'article::discussion/index',
80
-            ['list' => $discussions, 'layout' => 'layout/admin'])
80
+            [ 'list' => $discussions, 'layout' => 'layout/admin' ])
81 81
         );
82 82
     }
83 83
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @return \Psr\Http\Message\ResponseInterface
90 90
      */
91
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
91
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
92 92
     {
93 93
         $id = $this->request->getAttribute('id');
94 94
         $discussion = $this->discussionService->fetchSingleArticle($id);
95 95
         $categories = $this->categoryService->getAll(ArticleType::DISCUSSION);
96 96
 
97 97
         if ($this->request->getParsedBody()) {
98
-            $discussion = (object)($this->request->getParsedBody() + (array)$discussion);
98
+            $discussion = (object) ($this->request->getParsedBody() + (array) $discussion);
99 99
             $discussion->article_id = $id;
100 100
         }
101 101
 
Please login to merge, or discard this patch.
packages/Category/src/Filter/CategoryFilter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
                 [
20 20
                     'name' => 'name',
21 21
                     'required' => true,
22
-                    'filters' => [['name' => 'StringTrim']],
22
+                    'filters' => [ [ 'name' => 'StringTrim' ] ],
23 23
                     'validators' => [
24
-                        ['name' => 'NotEmpty'],
25
-                        ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]],
24
+                        [ 'name' => 'NotEmpty' ],
25
+                        [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ],
26 26
                     ],
27 27
                 ]
28 28
             );
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
                 [
32 32
                     'name' => 'slug',
33 33
                     'required' => true,
34
-                    'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]],
34
+                    'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ],
35 35
                     'validators' => [
36
-                        ['name' => 'NotEmpty'],
37
-                        ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
36
+                        [ 'name' => 'NotEmpty' ],
37
+                        [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
38 38
                     ],
39 39
                 ]
40 40
             );
@@ -43,24 +43,24 @@  discard block
 block discarded – undo
43 43
                 [
44 44
                     'name' => 'title',
45 45
                     'required' => false,
46
-                    'filters' => [['name' => 'StringTrim']],
46
+                    'filters' => [ [ 'name' => 'StringTrim' ] ],
47 47
                     'validators' => [
48
-                        ['name' => 'NotEmpty'],
49
-                        ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
48
+                        [ 'name' => 'NotEmpty' ],
49
+                        [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
50 50
                     ],
51 51
                 ]
52 52
             );
53 53
 
54
-            $inputFilter->add(['name' => 'type', 'required' => true]);
54
+            $inputFilter->add([ 'name' => 'type', 'required' => true ]);
55 55
 
56 56
             $inputFilter->add(
57 57
                 [
58 58
                     'name' => 'description',
59 59
                     'required' => false,
60
-                    'filters' => [['name' => 'StringTrim']],
60
+                    'filters' => [ [ 'name' => 'StringTrim' ] ],
61 61
                     'validators' => [
62
-                        ['name' => 'NotEmpty'],
63
-                        ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]],
62
+                        [ 'name' => 'NotEmpty' ],
63
+                        [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ],
64 64
                     ],
65 65
                 ]
66 66
             );
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 [
70 70
                     'name' => 'is_in_homepage',
71 71
                     'required' => false,
72
-                    'filters' => [['name' => 'Boolean']],
72
+                    'filters' => [ [ 'name' => 'Boolean' ] ],
73 73
                 ]
74 74
             );
75 75
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 [
78 78
                     'name' => 'is_in_category_list',
79 79
                     'required' => false,
80
-                    'filters' => [['name' => 'Boolean']],
80
+                    'filters' => [ [ 'name' => 'Boolean' ] ],
81 81
                 ]
82 82
             );
83 83
 
Please login to merge, or discard this patch.
packages/Category/src/Service/CategoryService.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function getCategoryBySlug($urlSlug)
77 77
     {
78
-        return $this->categoryMapper->select(['slug' => $urlSlug])->current();
78
+        return $this->categoryMapper->select([ 'slug' => $urlSlug ])->current();
79 79
     }
80 80
 
81 81
     /**
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         }
94 94
 
95 95
         $values                     = $filter->getValues();
96
-        $values['category_id']      = Uuid::uuid1()->toString();
97
-        $values['category_uuid']    = (new MysqlUuid($values['category_id']))->toFormat(new Binary);
98
-        $values['main_img']         = $this->upload->uploadImage($data, 'main_img');
96
+        $values[ 'category_id' ]      = Uuid::uuid1()->toString();
97
+        $values[ 'category_uuid' ]    = (new MysqlUuid($values[ 'category_id' ]))->toFormat(new Binary);
98
+        $values[ 'main_img' ]         = $this->upload->uploadImage($data, 'main_img');
99 99
 
100 100
         $this->categoryMapper->insert($values);
101 101
     }
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
             ];
126 126
 
127 127
         // We don't want to force user to re-upload image on edit
128
-        if (!$values['main_img']) {
129
-            unset($values['main_img']);
128
+        if (!$values[ 'main_img' ]) {
129
+            unset($values[ 'main_img' ]);
130 130
         } else {
131 131
             $this->upload->deleteFile($oldCategory->main_img);
132 132
         }
133 133
 
134
-        $this->categoryMapper->update($values, ['category_id' => $categoryId]);
134
+        $this->categoryMapper->update($values, [ 'category_id' => $categoryId ]);
135 135
     }
136 136
 
137 137
     /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
         $this->upload->deleteFile($category->main_img);
148 148
 
149
-        return (bool)$this->categoryMapper->delete(['category_id' => $categoryId]);
149
+        return (bool) $this->categoryMapper->delete([ 'category_id' => $categoryId ]);
150 150
     }
151 151
 
152 152
     /**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function getAll($type = null)
158 158
     {
159
-        if($type){
160
-            return $this->categoryMapper->select(['type' => $type]);
159
+        if ($type) {
160
+            return $this->categoryMapper->select([ 'type' => $type ]);
161 161
         }
162 162
 
163 163
         return $this->categoryMapper->select();
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
         $categories = $this->categoryMapper->getWeb(7, null, $inHomepage, $inCategoryList)->toArray();
176 176
 
177 177
         foreach ($categories as $ctn => $category) {
178
-            $select = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4);
178
+            $select = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4);
179 179
             $posts  = $this->categoryMapper->selectWith($select)->toArray();
180
-            $categories[$ctn]['posts'] = $posts;
180
+            $categories[ $ctn ][ 'posts' ] = $posts;
181 181
         }
182 182
 
183 183
         return $categories;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function getCategories($inCategoryList = null)
193 193
     {
194
-        return $this->categoryMapper->getWeb(null, ['name' => 'asc'], null, $inCategoryList);
194
+        return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ], null, $inCategoryList);
195 195
     }
196 196
 
197 197
     /**
Please login to merge, or discard this patch.
packages/Category/src/Controller/IndexController.php 1 patch
Spacing   +5 added lines, -5 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 Category\Controller;
6 6
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
     public function index(): \Psr\Http\Message\ResponseInterface
54 54
     {
55 55
         $params = $this->request->getQueryParams();
56
-        $page   = isset($params['page']) ? $params['page'] : 1;
57
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
56
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
57
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
58 58
 
59 59
         $categories = $this->categoryService->getPagination($page, $limit);
60 60
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return \Psr\Http\Message\ResponseInterface
71 71
      */
72
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
72
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
73 73
     {
74 74
         $id       = $this->request->getAttribute('id');
75 75
         $category = $this->categoryService->getCategory($id);
76 76
 
77 77
         if ($this->request->getParsedBody()) {
78
-            $category = (object)($this->request->getParsedBody() + (array)$category);
78
+            $category = (object) ($this->request->getParsedBody() + (array) $category);
79 79
             $category->category_id = $id;
80 80
         }
81 81
 
Please login to merge, or discard this patch.
packages/Category/src/Mapper/CategoryMapper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function get($id)
35 35
     {
36
-        return $this->select(['category_id' => $id])->current();
36
+        return $this->select([ 'category_id' => $id ])->current();
37 37
     }
38 38
 
39 39
     public function getPaginationSelect()
40 40
     {
41
-        $select = $this->getSql()->select()->order(['name' => 'asc']);
41
+        $select = $this->getSql()->select()->order([ 'name' => 'asc' ]);
42 42
 
43 43
         return $select;
44 44
     }
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
     public function getCategoryPostsSelect($categoryId = null, $limit = null)
47 47
     {
48 48
         $select = $this->getSql()->select()
49
-            ->columns(['category_name' => 'name', 'category_slug' => 'slug'])
49
+            ->columns([ 'category_name' => 'name', 'category_slug' => 'slug' ])
50 50
             ->join('articles', 'articles.category_uuid = category.category_uuid',
51
-                ['article_id', 'slug', 'admin_user_uuid', 'published_at']
52
-            )->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', ['*'], 'right')
51
+                [ 'article_id', 'slug', 'admin_user_uuid', 'published_at' ]
52
+            )->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', [ '*' ], 'right')
53 53
             ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid',
54
-                ['admin_user_id', 'first_name', 'last_name', 'face_img']
55
-            )->where(['articles.status' => 1])
56
-            ->order(['published_at' => 'desc']);
54
+                [ 'admin_user_id', 'first_name', 'last_name', 'face_img' ]
55
+            )->where([ 'articles.status' => 1 ])
56
+            ->order([ 'published_at' => 'desc' ]);
57 57
 
58 58
         if ($categoryId) {
59
-            $select->where(['category_id' => $categoryId]);
59
+            $select->where([ 'category_id' => $categoryId ]);
60 60
         }
61 61
 
62 62
         if ($limit) {
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
         $inHomepage = null,
84 84
         $inCategoryList = null
85 85
     ) {
86
-        $select = $this->getSql()->select()->where(['type' => ArticleType::POST]);
86
+        $select = $this->getSql()->select()->where([ 'type' => ArticleType::POST ]);
87 87
 
88 88
         if ($inHomepage !== null) {
89
-            $select->where(['is_in_homepage' => $inHomepage]);
89
+            $select->where([ 'is_in_homepage' => $inHomepage ]);
90 90
         }
91 91
 
92 92
         if ($inCategoryList !== null) {
93
-            $select->where(['is_in_category_list' => $inCategoryList]);
93
+            $select->where([ 'is_in_category_list' => $inCategoryList ]);
94 94
         }
95 95
 
96 96
         if ($limit) {
Please login to merge, or discard this patch.
packages/Category/src/View/Helper/CategoryHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Category\View\Helper;
5 5
 
Please login to merge, or discard this patch.
data/phinx/migrations/20161003183353_articles.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@
 block discarded – undo
6 6
 {
7 7
     public function up()
8 8
     {
9
-        $this->table('articles', ['id' => false, 'primary_key' => 'article_uuid'])
10
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
9
+        $this->table('articles', [ 'id' => false, 'primary_key' => 'article_uuid' ])
10
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
11 11
             ->addColumn('article_id', 'text')
12
-            ->addColumn('slug', 'text', ['null' => true])
13
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
14
-            ->addColumn('published_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
12
+            ->addColumn('slug', 'text', [ 'null' => true ])
13
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
14
+            ->addColumn('published_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
15 15
             ->addColumn('type', 'integer')      // see Article\Entity\ArticleType
16 16
             ->addColumn('status', 'integer')    // active, not active, ...
17
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
18
-            ->addColumn('is_wysiwyg_editor', 'boolean', ['default' => false])
19
-            ->addColumn('category_uuid', 'binary', ['limit' => 16])
20
-            ->addForeignKey('category_uuid', 'category', 'category_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
21
-            ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
22
-            ->addIndex('type', ['name' => 'type_INDEX'])
23
-            ->addIndex('published_at', ['name' => 'published_at_INDEX'])
17
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
18
+            ->addColumn('is_wysiwyg_editor', 'boolean', [ 'default' => false ])
19
+            ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ])
20
+            ->addForeignKey('category_uuid', 'category', 'category_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
21
+            ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
22
+            ->addIndex('type', [ 'name' => 'type_INDEX' ])
23
+            ->addIndex('published_at', [ 'name' => 'published_at_INDEX' ])
24 24
             ->create();
25 25
     }
26 26
 
Please login to merge, or discard this patch.