Completed
Push — master ( d127e1...fbccd8 )
by Aleksandar
26:32
created
data/phinx/migrations/20161003183350_category.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
 
10 10
     public function up()
11 11
     {
12
-        $this->table('category', ['id' => false, 'primary_key' => 'category_uuid'])
13
-            ->addColumn('category_uuid', 'binary', ['limit' => 16])
12
+        $this->table('category', [ 'id' => false, 'primary_key' => 'category_uuid' ])
13
+            ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ])
14 14
             ->addColumn('category_id', 'text')
15 15
             ->addColumn('name', 'text')
16 16
             ->addColumn('slug', 'text')
17
-            ->addColumn('title', 'text', ['null' => true])
18
-            ->addColumn('description', 'text', ['null' => true])
19
-            ->addColumn('main_img', 'text', ['null' => true])
20
-            ->addColumn('is_in_homepage', 'boolean', ['default' => false])
21
-            ->addColumn('is_in_category_list', 'boolean', ['default' => true])
17
+            ->addColumn('title', 'text', [ 'null' => true ])
18
+            ->addColumn('description', 'text', [ 'null' => true ])
19
+            ->addColumn('main_img', 'text', [ 'null' => true ])
20
+            ->addColumn('is_in_homepage', 'boolean', [ 'default' => false ])
21
+            ->addColumn('is_in_category_list', 'boolean', [ 'default' => true ])
22 22
             ->create();
23 23
     }
24 24
 
Please login to merge, or discard this patch.
packages/Web/Action/CategoryAction.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 Web\Action;
6 6
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     public function __invoke(Request $request, Response $response, callable $next = null)
52 52
     {
53 53
         $params     = $request->getQueryParams();
54
-        $page       = isset($params['page']) ? $params['page'] : 1;
54
+        $page       = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
55 55
         $urlSlug    = $request->getAttribute('category');
56 56
         $categories = $this->categoryService->getCategories(true);
57 57
         $category   = $this->categoryService->getCategoryBySlug($urlSlug);
58 58
 
59
-        if(!$category) {
60
-            if($urlSlug !== 'all') {
59
+        if (!$category) {
60
+            if ($urlSlug !== 'all') {
61 61
                 return $next($request, $response);
62 62
             }
63 63
 
64
-            $category = (object)[
64
+            $category = (object) [
65 65
                 'name'        => 'Svi članci',
66 66
                 'slug'        => 'all',
67 67
                 'title'       => 'Svi članci',
Please login to merge, or discard this patch.
packages/Web/Action/EventsAction.php 2 patches
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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function __invoke(Request $request, Response $response, callable $next = null)
54 54
     {
55 55
         $params       = $request->getQueryParams();
56
-        $page         = isset($params['page']) ? $params['page'] : 1;
56
+        $page         = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
57 57
         $futureEvents = $this->eventService->fetchFutureEvents();
58 58
         $pastEvents   = $this->eventService->fetchPastEventsPagination($page, 10);
59 59
         $category     = $this->categoryService->getCategoryBySlug('events');
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,21 +21,21 @@
 block discarded – undo
21 21
     /**
22 22
 * 
23 23
      *
24
- * @var Template 
24
+     * @var Template 
25 25
 */
26 26
     private $template;
27 27
 
28 28
     /**
29 29
 * 
30 30
      *
31
- * @var EventService 
31
+     * @var EventService 
32 32
 */
33 33
     private $eventService;
34 34
 
35 35
     /**
36 36
 * 
37 37
      *
38
- * @var CategoryService 
38
+     * @var CategoryService 
39 39
 */
40 40
     private $categoryService;
41 41
 
Please login to merge, or discard this patch.
packages/Web/Action/VideosAction.php 2 patches
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
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function __invoke(Request $request, Response $response, callable $next = null)
52 52
     {
53 53
         $params   = $request->getQueryParams();
54
-        $page     = isset($params['page']) ? $params['page'] : 1;
54
+        $page     = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
55 55
         $videos   = $this->videoService->fetchWebArticles($page, 5);
56 56
         $category = $this->categoryService->getCategoryBySlug('videos');
57 57
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,21 +21,21 @@
 block discarded – undo
21 21
     /**
22 22
 * 
23 23
      *
24
- * @var Template 
24
+     * @var Template 
25 25
 */
26 26
     private $template;
27 27
 
28 28
     /**
29 29
 * 
30 30
      *
31
- * @var VideoService 
31
+     * @var VideoService 
32 32
 */
33 33
     private $videoService;
34 34
 
35 35
     /**
36 36
 * 
37 37
      *
38
- * @var CategoryService 
38
+     * @var CategoryService 
39 39
 */
40 40
     private $categoryService;
41 41
 
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
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      */
33 33
     public function forHomepage()
34 34
     {
35
-        if(!$this->homepageCategories) {
35
+        if (!$this->homepageCategories) {
36 36
             $this->homepageCategories = $this->categoryService->getCategoriesWithPosts(true);
37 37
         }
38 38
 
Please login to merge, or discard this patch.
packages/Category/src/Factory/Service/CategoryServiceFactory.php 1 patch
Spacing   +3 added lines, -3 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 Category\Factory\Service;
5 5
 
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __invoke(ContainerInterface $container): CategoryService
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 CategoryService(
27 27
             $container->get(CategoryMapper::class),
Please login to merge, or discard this patch.
packages/Category/src/Service/CategoryService.php 3 patches
Spacing   +16 added lines, -16 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 Category\Service;
5 5
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getCategoryBySlug($urlSlug)
78 78
     {
79
-        return $this->categoryMapper->select(['slug' => $urlSlug])->current();
79
+        return $this->categoryMapper->select([ 'slug' => $urlSlug ])->current();
80 80
     }
81 81
 
82 82
     /**
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $filter = $this->categoryFilter->getInputFilter()->setData($data);
91 91
 
92
-        if(!$filter->isValid()) {
92
+        if (!$filter->isValid()) {
93 93
             throw new FilterException($filter->getMessages());
94 94
         }
95 95
 
96 96
         $values                   = $filter->getValues();
97
-        $values['category_id']    = Uuid::uuid1()->toString();
98
-        $values['category_uuid']  = (new MysqlUuid($values['category_id']))->toFormat(new Binary);
99
-        $values['main_img']       = $this->upload->uploadImage($data, 'main_img');
97
+        $values[ 'category_id' ]    = Uuid::uuid1()->toString();
98
+        $values[ 'category_uuid' ]  = (new MysqlUuid($values[ 'category_id' ]))->toFormat(new Binary);
99
+        $values[ 'main_img' ]       = $this->upload->uploadImage($data, 'main_img');
100 100
 
101 101
         $this->categoryMapper->insert($values);
102 102
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         $filter = $this->categoryFilter->getInputFilter()->setData($data);
119 119
 
120
-        if(!$filter->isValid()) {
120
+        if (!$filter->isValid()) {
121 121
             throw new FilterException($filter->getMessages());
122 122
         }
123 123
 
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
             ];
127 127
 
128 128
         // We don't want to force user to re-upload image on edit
129
-        if(!$values['main_img']) {
130
-            unset($values['main_img']);
129
+        if (!$values[ 'main_img' ]) {
130
+            unset($values[ 'main_img' ]);
131 131
         }
132
-        else{
132
+        else {
133 133
             $this->upload->deleteFile($oldCategory->main_img);
134 134
         }
135 135
 
136
-        $this->categoryMapper->update($values, ['category_id' => $categoryId]);
136
+        $this->categoryMapper->update($values, [ 'category_id' => $categoryId ]);
137 137
     }
138 138
 
139 139
     /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         $this->upload->deleteFile($category->main_img);
150 150
 
151
-        return (bool)$this->categoryMapper->delete(['category_id' => $categoryId]);
151
+        return (bool) $this->categoryMapper->delete([ 'category_id' => $categoryId ]);
152 152
     }
153 153
 
154 154
     /**
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
     {
173 173
         $categories = $this->categoryMapper->getWeb(7, null, $inHomepage, $inCategoryList)->toArray();
174 174
 
175
-        foreach($categories as $ctn => $category) {
176
-            $select                    = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4);
175
+        foreach ($categories as $ctn => $category) {
176
+            $select                    = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4);
177 177
             $posts                     = $this->categoryMapper->selectWith($select)->toArray();
178
-            $categories[$ctn]['posts'] = $posts;
178
+            $categories[ $ctn ][ 'posts' ] = $posts;
179 179
         }
180 180
 
181 181
         return $categories;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function getCategories($inCategoryList = null)
191 191
     {
192
-        return $this->categoryMapper->getWeb(null, ['name' => 'asc'], null, $inCategoryList);
192
+        return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ], null, $inCategoryList);
193 193
     }
194 194
 
195 195
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,8 +128,7 @@
 block discarded – undo
128 128
         // We don't want to force user to re-upload image on edit
129 129
         if(!$values['main_img']) {
130 130
             unset($values['main_img']);
131
-        }
132
-        else{
131
+        } else{
133 132
             $this->upload->deleteFile($oldCategory->main_img);
134 133
         }
135 134
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     /**
165 165
      * Return categories with posts/articles
166 166
      *
167
-     * @param  null $inHomepage
167
+     * @param  boolean $inHomepage
168 168
      * @param  null $inCategoryList
169 169
      * @return mixed
170 170
      */
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     /**
185 185
      * Return categories posts/articles
186 186
      *
187
-     * @param  null $inCategoryList
187
+     * @param  boolean $inCategoryList
188 188
      * @return null|\Zend\Db\ResultSet\ResultSetInterface
189 189
      */
190 190
     public function getCategories($inCategoryList = null)
Please login to merge, or discard this patch.
packages/Article/src/Service/ArticleServiceInterface.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
     /**
13 13
      * Fetches a list of ArticleEntity models.
14 14
      *
15
-     * @param  array $params
16 15
      * @return ArrayObject
17 16
      */
18 17
     public function fetchAllArticles($page, $limit);
Please login to merge, or discard this patch.
packages/Menu/src/Controller/IndexController.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
         );
54 54
     }
55 55
 
56
-    public function edit($errors = [])
56
+    public function edit($errors = [ ])
57 57
     {
58 58
         $id   = $this->request->getAttribute('id');
59 59
         $item = $this->menuService->get($id);
60 60
 
61
-        if($this->request->getParsedBody()) {
62
-            $item          = (object)($this->request->getParsedBody() + (array)$item);
61
+        if ($this->request->getParsedBody()) {
62
+            $item          = (object) ($this->request->getParsedBody() + (array) $item);
63 63
             $item->menu_id = $id;
64 64
         }
65 65
 
@@ -78,36 +78,36 @@  discard block
 block discarded – undo
78 78
 
79 79
     public function save()
80 80
     {
81
-        try{
81
+        try {
82 82
             $id   = $this->request->getAttribute('id');
83 83
             $data = $this->request->getParsedBody();
84 84
 
85
-            if($id) {
85
+            if ($id) {
86 86
                 $this->menuService->updateMenuItem($data, $id);
87 87
             }
88
-            else{
88
+            else {
89 89
                 $this->menuService->addMenuItem($data);
90 90
             }
91 91
 
92 92
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
93 93
         }
94
-        catch(FilterException $fe){
94
+        catch (FilterException $fe) {
95 95
             return $this->edit($fe->getArrayMessages());
96 96
         }
97
-        catch(\Exception $e){
97
+        catch (\Exception $e) {
98 98
             throw $e;
99 99
         }
100 100
     }
101 101
 
102 102
     public function delete()
103 103
     {
104
-        try{
104
+        try {
105 105
             $id = $this->request->getAttribute('id');
106 106
             $this->menuService->delete($id);
107 107
 
108 108
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
109 109
         }
110
-        catch(\Exception $e){
110
+        catch (\Exception $e) {
111 111
             throw $e;
112 112
         }
113 113
     }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
     public function updateOrder()
116 116
     {
117 117
         $data      = $this->request->getParsedBody();
118
-        $menuOrder = isset($data['order']) ? json_decode($data['order']) : [];
118
+        $menuOrder = isset($data[ 'order' ]) ? json_decode($data[ 'order' ]) : [ ];
119 119
         $status    = $this->menuService->updateMenuOrder($menuOrder);
120 120
 
121
-        return new JsonResponse(['status' => $status]);
121
+        return new JsonResponse([ 'status' => $status ]);
122 122
     }
123 123
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -84,17 +84,14 @@  discard block
 block discarded – undo
84 84
 
85 85
             if($id) {
86 86
                 $this->menuService->updateMenuItem($data, $id);
87
-            }
88
-            else{
87
+            } else{
89 88
                 $this->menuService->addMenuItem($data);
90 89
             }
91 90
 
92 91
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
93
-        }
94
-        catch(FilterException $fe){
92
+        } catch(FilterException $fe){
95 93
             return $this->edit($fe->getArrayMessages());
96
-        }
97
-        catch(\Exception $e){
94
+        } catch(\Exception $e){
98 95
             throw $e;
99 96
         }
100 97
     }
@@ -106,8 +103,7 @@  discard block
 block discarded – undo
106 103
             $this->menuService->delete($id);
107 104
 
108 105
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
109
-        }
110
-        catch(\Exception $e){
106
+        } catch(\Exception $e){
111 107
             throw $e;
112 108
         }
113 109
     }
Please login to merge, or discard this patch.