Passed
Push — master ( dd4450...9a9614 )
by Andrey
05:55
created
models/ArticleSearch.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function search($params)
58 58
     {
59
-        $query = Article::find()->joinWith(['articlesLanguages']);
59
+        $query = Article::find()->joinWith([ 'articlesLanguages' ]);
60 60
 
61 61
         // add conditions that should always apply here
62 62
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
             'active' => $this->active,
79 79
         ]);
80 80
 
81
-        $query->andFilterWhere(['like', 'articles_language.title', $this->title]);
81
+        $query->andFilterWhere([ 'like', 'articles_language.title', $this->title ]);
82 82
 
83 83
         $pagination = new Pagination([
84
-            'defaultPageSize' => Yii::$app->params['defaultPageSize'],
84
+            'defaultPageSize' => Yii::$app->params[ 'defaultPageSize' ],
85 85
             'totalCount' => $query->count(),
86 86
         ]);
87 87
 
Please login to merge, or discard this patch.
models/Article.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * @var array
51 51
      */
52
-    public $albums = [];
52
+    public $albums = [ ];
53 53
 
54 54
     /**
55 55
      * Init albums.
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
             [
109 109
                 'alias',
110 110
                 'filter',
111
-                'filter' => function ($value) {
112
-                    return preg_replace( '/[^a-z0-9_]+/', '-', strtolower(trim($value)));
111
+                'filter' => function($value) {
112
+                    return preg_replace('/[^a-z0-9_]+/', '-', strtolower(trim($value)));
113 113
                 }
114 114
             ],
115 115
             [
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
                 'exist',
127 127
                 'skipOnError' => true,
128 128
                 'targetClass' => Page::class,
129
-                'targetAttribute' => ['pageId' => 'id']
129
+                'targetAttribute' => [ 'pageId' => 'id' ]
130 130
             ],
131 131
             [
132 132
                 UploadModelInterface::FILE_TYPE_THUMB,
133
-                function($attribute){
134
-                    if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})){
133
+                function($attribute) {
134
+                    if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})) {
135 135
                         $this->addError($attribute, 'Tumbnail content must be a numeric or string.');
136 136
                     }
137 137
                 },
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             [
150 150
                 'albums',
151 151
                 'each',
152
-                'rule' => ['integer'],
152
+                'rule' => [ 'integer' ],
153 153
             ],
154 154
         ];
155 155
     }
Please login to merge, or discard this patch.
config/admin/main-menu.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Itstructure\AdminModule\Module as AdminModule;
4 4
 use Itstructure\RbacModule\Module as RbacModule;
5 5
 
6
-$shortLanguage = $this->view->params['shortLanguage'];
6
+$shortLanguage = $this->view->params[ 'shortLanguage' ];
7 7
 $controllerId = Yii::$app->controller->id;
8 8
 
9 9
 return [
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                     'active' => $controllerId == 'profiles'
51 51
                 ],
52 52
             ],
53
-            'active' => in_array($controllerId, ['roles', 'permissions', 'profiles'])
53
+            'active' => in_array($controllerId, [ 'roles', 'permissions', 'profiles' ])
54 54
         ],
55 55
         'positions' => [
56 56
             'title' => Yii::t('positions', 'Positions'),
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     'active' => $controllerId == 'qualities'
113 113
                 ],
114 114
             ],
115
-            'active' => in_array($controllerId, ['about', 'technologies', 'qualities'])
115
+            'active' => in_array($controllerId, [ 'about', 'technologies', 'qualities' ])
116 116
         ],
117 117
         'contacts' => [
118 118
             'title' => Yii::t('contacts', 'Contacts'),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                     'active' => $controllerId == 'social'
133 133
                 ],
134 134
             ],
135
-            'active' => in_array($controllerId, ['contacts', 'social'])
135
+            'active' => in_array($controllerId, [ 'contacts', 'social' ])
136 136
         ],
137 137
         'home' => [
138 138
             'title' => Yii::t('home', 'Home page'),
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                     'active' => $controllerId == 'other-album'
183 183
                 ],
184 184
             ],
185
-            'active' => in_array($controllerId, ['image-album', 'audio-album', 'video-album', 'application-album', 'text-album', 'other-album'])
185
+            'active' => in_array($controllerId, [ 'image-album', 'audio-album', 'video-album', 'application-album', 'text-album', 'other-album' ])
186 186
         ],
187 187
         'sitemap' => [
188 188
             'title' => Yii::t('app', 'Sitemap'),
Please login to merge, or discard this patch.
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.