Completed
Push — master ( 41e170...f7d2da )
by Aleksandar
189:39 queued 165:17
created
packages/Category/src/Service/CategoryService.php 1 patch
Spacing   +12 added lines, -12 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
     /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function getAll($type = null)
158 158
     {
159 159
         if ($type) {
160
-            return $this->categoryMapper->select(['type' => $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.