@@ -56,7 +56,7 @@ discard block |
||
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 |
||
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 |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
149 | 149 | [ |
150 | 150 | 'albums', |
151 | 151 | 'each', |
152 | - 'rule' => ['integer'], |
|
152 | + 'rule' => [ 'integer' ], |
|
153 | 153 | ], |
154 | 154 | ]; |
155 | 155 | } |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'), |
@@ -46,7 +46,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -20,7 +20,7 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -72,10 +72,10 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -27,15 +27,15 @@ discard block |
||
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 |
||
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', [ |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |