Passed
Push — master ( 4e12fe...ad0383 )
by Andrey
04:42
created
components/BasketComponent.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * @var array
48 48
      */
49
-    private $modelAdditionKeys = [];
49
+    private $modelAdditionKeys = [ ];
50 50
 
51 51
     /**
52 52
      * @var null|array
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $userModelInterfaces = class_implements($modelClass);
91 91
 
92
-        if (!isset($userModelInterfaces[ActiveRecordInterface::class])) {
92
+        if (!isset($userModelInterfaces[ ActiveRecordInterface::class ])) {
93 93
             throw new \Exception('Model class must be implemented from "'.ActiveRecordInterface::class.'".');
94 94
         }
95 95
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
                 $modelId => $count
162 162
             ];
163 163
 
164
-        } else if (isset($sessionData[$modelId])) {
165
-            $sessionData[$modelId] += $count;
164
+        } else if (isset($sessionData[ $modelId ])) {
165
+            $sessionData[ $modelId ] += $count;
166 166
 
167 167
         } else {
168
-            $sessionData[$modelId] = $count;
168
+            $sessionData[ $modelId ] = $count;
169 169
         }
170 170
 
171 171
         $this->fillSessionData($sessionData);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             throw new \Exception('Session storage is not full.');
177 177
         }
178 178
 
179
-        if (!isset($result[$modelId])) {
179
+        if (!isset($result[ $modelId ])) {
180 180
             throw new \Exception('Order item is not set to storage.');
181 181
         }
182 182
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
             throw new \Exception('Session data must be an array.');
202 202
         }
203 203
 
204
-        if (!isset($sessionData[$modelId])) {
204
+        if (!isset($sessionData[ $modelId ])) {
205 205
             throw new \Exception('Order item not found in a storage.');
206 206
         }
207 207
 
208
-        $sessionData[$modelId] = $count;
208
+        $sessionData[ $modelId ] = $count;
209 209
 
210 210
         $this->fillSessionData($sessionData);
211 211
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
             throw new \Exception('Session data must be an array.');
230 230
         }
231 231
 
232
-        if (!isset($sessionData[$modelId])) {
232
+        if (!isset($sessionData[ $modelId ])) {
233 233
             throw new \Exception('Order item not found in a storage.');
234 234
         }
235 235
 
236 236
         if (count($sessionData) > 1) {
237
-            unset($sessionData[$modelId]);
237
+            unset($sessionData[ $modelId ]);
238 238
             $this->fillSessionData($sessionData);
239 239
 
240 240
         } else {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $amount = 0;
291 291
 
292 292
         foreach ($modelItems as $item) {
293
-            $amount += ($item->{$this->modelAmountKey} * $sessionData[$item->{$this->modelPrimaryKey}]);
293
+            $amount += ($item->{$this->modelAmountKey}*$sessionData[ $item->{$this->modelPrimaryKey} ]);
294 294
         }
295 295
 
296 296
         return $amount;
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
         $sessionData = $this->retrieveSessionData();
305 305
 
306 306
         if (empty($sessionData)) {
307
-            return [];
307
+            return [ ];
308 308
         }
309 309
 
310 310
         $modelClass = $this->modelClass;
311 311
 
312
-        $modelItems = [];
313
-        $selection = [$this->modelPrimaryKey, $this->modelAmountKey];
312
+        $modelItems = [ ];
313
+        $selection = [ $this->modelPrimaryKey, $this->modelAmountKey ];
314 314
 
315 315
         foreach ($this->modelAdditionKeys as $additionKey) {
316
-            $selection[] = $additionKey;
316
+            $selection[ ] = $additionKey;
317 317
         }
318 318
 
319
-        $models = $modelClass::find()->where(['in', $this->modelPrimaryKey, array_keys($sessionData)])->select($selection)->all();
319
+        $models = $modelClass::find()->where([ 'in', $this->modelPrimaryKey, array_keys($sessionData) ])->select($selection)->all();
320 320
 
321 321
         foreach ($models as $model) {
322
-            $modelItems[$model->{$this->modelPrimaryKey}] = $model;
322
+            $modelItems[ $model->{$this->modelPrimaryKey} ] = $model;
323 323
         }
324 324
 
325 325
         return $modelItems;
Please login to merge, or discard this patch.
traits/AdditionFieldsTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      * @param array $paginationOptions
21 21
      * @return array
22 22
      */
23
-    protected function getMediaFiles(string $ownerName, int $ownerId, string $ownerAttribute, array $paginationOptions = [])
23
+    protected function getMediaFiles(string $ownerName, int $ownerId, string $ownerAttribute, array $paginationOptions = [ ])
24 24
     {
25 25
         $mediafilesQuery = OwnerMediafile::getMediaFilesQuery([
26 26
             'owner' => $ownerName,
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             'ownerAttribute' => $ownerAttribute,
29 29
         ]);
30 30
         $pagination = new Pagination(array_merge([
31
-                'defaultPageSize' => Yii::$app->params['defaultPageSize'],
31
+                'defaultPageSize' => Yii::$app->params[ 'defaultPageSize' ],
32 32
                 'totalCount' => $mediafilesQuery->count()
33 33
             ], $paginationOptions)
34 34
         );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         ]);
53 53
 
54 54
         if (!empty($type)) {
55
-            $albumsQuery = $albumsQuery->where(['type' => $type]);
55
+            $albumsQuery = $albumsQuery->where([ 'type' => $type ]);
56 56
         }
57 57
 
58 58
         return $albumsQuery->all();
Please login to merge, or discard this patch.
controllers/ajax/OrderAjaxController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
     public function verbs()
73 73
     {
74 74
         return [
75
-            'put-to-basket' => ['POST'],
76
-            'set-count-in-basket' => ['POST'],
77
-            'remove-from-basket' => ['POST'],
78
-            'send-order' => ['POST'],
75
+            'put-to-basket' => [ 'POST' ],
76
+            'set-count-in-basket' => [ 'POST' ],
77
+            'remove-from-basket' => [ 'POST' ],
78
+            'send-order' => [ 'POST' ],
79 79
         ];
80 80
     }
81 81
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 return $this->getSuccessResponse('', [
120 120
                     'total_amount' => $this->basketManager->calculateTotalAmount($modelItems),
121 121
                     'total_count' => $this->basketManager->getTotalCount(),
122
-                    'item_price' => $modelItems[$id]->price
122
+                    'item_price' => $modelItems[ $id ]->price
123 123
                 ]);
124 124
             }
125 125
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $order = new Order();
164 164
             $order->setAttributes(Yii::$app->request->post(), false);
165 165
 
166
-            if ($order->handle(Yii::$app->params['adminEmail'])) {
166
+            if ($order->handle(Yii::$app->params[ 'adminEmail' ])) {
167 167
                 $this->basketManager->clearBasket();
168 168
                 return $this->getSuccessResponse(Yii::t('order', 'You have successfully sent your order message.').' '.Yii::t('order', 'The manager will contact you.'));
169 169
 
Please login to merge, or discard this patch.
controllers/PageController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
                 'rules' => [
28 28
                     [
29 29
                         'allow' => true,
30
-                        'actions' => ['view'],
31
-                        'roles' => ['?', '@'],
30
+                        'actions' => [ 'view' ],
31
+                        'roles' => [ '?', '@' ],
32 32
                     ],
33 33
                 ],
34 34
             ],
35 35
             'verbs' => [
36 36
                 'class' => VerbFilter::class,
37 37
                 'actions' => [
38
-                    'view' => ['get'],
38
+                    'view' => [ 'get' ],
39 39
                 ],
40 40
             ],
41 41
         ]);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         $pagination = new Pagination([
73 73
             'totalCount' => $articlesQuery->count(),
74
-            'defaultPageSize' => Yii::$app->params['defaultPageSize']
74
+            'defaultPageSize' => Yii::$app->params[ 'defaultPageSize' ]
75 75
         ]);
76 76
 
77 77
         return $this->render('view', [
Please login to merge, or discard this patch.
controllers/admin/ProductController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return $this->accessError();
51 51
         }
52 52
 
53
-        $this->additionFields['images'] = $this->getMediaFiles(Product::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
53
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Product::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
54 54
 
55 55
         return parent::actionView($id);
56 56
     }
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             return $this->accessError();
65 65
         }
66 66
 
67
-        $this->additionFields['categories'] = Category::getMenu();
68
-        $this->additionFields['albums'] = $this->getAlbums();
67
+        $this->additionFields[ 'categories' ] = Category::getMenu();
68
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
69 69
 
70 70
         return parent::actionCreate();
71 71
     }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             return $this->accessError();
82 82
         }
83 83
 
84
-        $this->additionFields['categories'] = Category::getMenu();
85
-        $this->additionFields['albums'] = $this->getAlbums();
86
-        $this->additionFields['images'] = $this->getMediaFiles(Product::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
84
+        $this->additionFields[ 'categories' ] = Category::getMenu();
85
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
86
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Product::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
87 87
 
88 88
         return parent::actionUpdate($id);
89 89
     }
Please login to merge, or discard this patch.
controllers/admin/PageController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return $this->accessError();
51 51
         }
52 52
 
53
-        $this->additionFields['images'] = $this->getMediaFiles(Page::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
53
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Page::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
54 54
 
55 55
         return parent::actionView($id);
56 56
     }
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             return $this->accessError();
65 65
         }
66 66
 
67
-        $this->additionFields['pages'] = Page::getMenu();
68
-        $this->additionFields['albums'] = $this->getAlbums();
67
+        $this->additionFields[ 'pages' ] = Page::getMenu();
68
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
69 69
 
70 70
         return parent::actionCreate();
71 71
     }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             return $this->accessError();
82 82
         }
83 83
 
84
-        $this->additionFields['pages'] = Page::getMenu();
85
-        $this->additionFields['albums'] = $this->getAlbums();
86
-        $this->additionFields['images'] = $this->getMediaFiles(Page::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
84
+        $this->additionFields[ 'pages' ] = Page::getMenu();
85
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
86
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Page::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
87 87
 
88 88
         return parent::actionUpdate($id);
89 89
     }
Please login to merge, or discard this patch.
controllers/admin/ArticleController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return $this->accessError();
51 51
         }
52 52
 
53
-        $this->additionFields['images'] = $this->getMediaFiles(Article::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
53
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Article::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
54 54
 
55 55
         return parent::actionView($id);
56 56
     }
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             return $this->accessError();
65 65
         }
66 66
 
67
-        $this->additionFields['pages'] = Page::getMenu();
68
-        $this->additionFields['albums'] = $this->getAlbums();
67
+        $this->additionFields[ 'pages' ] = Page::getMenu();
68
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
69 69
 
70 70
         return parent::actionCreate();
71 71
     }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             return $this->accessError();
82 82
         }
83 83
 
84
-        $this->additionFields['pages'] = Page::getMenu();
85
-        $this->additionFields['albums'] = $this->getAlbums();
86
-        $this->additionFields['images'] = $this->getMediaFiles(Article::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
84
+        $this->additionFields[ 'pages' ] = Page::getMenu();
85
+        $this->additionFields[ 'albums' ] = $this->getAlbums();
86
+        $this->additionFields[ 'images' ] = $this->getMediaFiles(Article::tableName(), (int)$id, UploadModelInterface::FILE_TYPE_IMAGE);
87 87
 
88 88
         return parent::actionUpdate($id);
89 89
     }
Please login to merge, or discard this patch.
controllers/admin/CategoryController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             return $this->accessError();
62 62
         }
63 63
 
64
-        $this->additionFields['categories'] = Category::getMenu();
64
+        $this->additionFields[ 'categories' ] = Category::getMenu();
65 65
 
66 66
         return parent::actionCreate();
67 67
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             return $this->accessError();
78 78
         }
79 79
 
80
-        $this->additionFields['categories'] = Category::getMenu();
80
+        $this->additionFields[ 'categories' ] = Category::getMenu();
81 81
 
82 82
         return parent::actionUpdate($id);
83 83
     }
Please login to merge, or discard this patch.
controllers/BaseController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function beforeAction($action)
33 33
     {
34
-        $this->view->params['pages'] = Page::getActiveMenu();
35
-        $this->view->params['categories'] = Category::getActiveMenu();
36
-        $this->view->params['contacts'] = Contact::getDefaultContacts();
37
-        $this->view->params['controllerId'] = Yii::$app->controller->id;
34
+        $this->view->params[ 'pages' ] = Page::getActiveMenu();
35
+        $this->view->params[ 'categories' ] = Category::getActiveMenu();
36
+        $this->view->params[ 'contacts' ] = Contact::getDefaultContacts();
37
+        $this->view->params[ 'controllerId' ] = Yii::$app->controller->id;
38 38
 
39 39
         return parent::beforeAction($action);
40 40
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             $this->view->registerLinkTag([
76 76
                 'rel' => 'alternate',
77 77
                 'hreflang' => $shortName,
78
-                'href' => rtrim(Yii::$app->request->hostInfo, '/') .
78
+                'href' => rtrim(Yii::$app->request->hostInfo, '/').
79 79
                     BaseHelper::getSwitchLanguageLink($shortName, Yii::$app->request)
80 80
             ]);
81 81
         }
Please login to merge, or discard this patch.