@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$params = require __DIR__ . '/params.php'; |
|
4 | -$db = require __DIR__ . '/db.php'; |
|
3 | +$params = require __DIR__.'/params.php'; |
|
4 | +$db = require __DIR__.'/db.php'; |
|
5 | 5 | |
6 | 6 | $config = [ |
7 | 7 | 'id' => 'yii2_template_multilanguage', |
8 | 8 | 'version' => '1.1.0', |
9 | 9 | 'basePath' => dirname(__DIR__), |
10 | 10 | 'homeUrl' => YII_DEBUG ? 'http://yii2-template-multilanguage' : 'http://yii2-template-multilanguage', |
11 | - 'bootstrap' => ['log'], |
|
11 | + 'bootstrap' => [ 'log' ], |
|
12 | 12 | 'language' => 'en-US', |
13 | 13 | 'aliases' => [ |
14 | 14 | '@bower' => '@vendor/bower-asset', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'targets' => [ |
51 | 51 | [ |
52 | 52 | 'class' => 'yii\log\FileTarget', |
53 | - 'levels' => ['error', 'warning'], |
|
53 | + 'levels' => [ 'error', 'warning' ], |
|
54 | 54 | ], |
55 | 55 | ], |
56 | 56 | ], |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | |
210 | 210 | if (YII_ENV_DEV) { |
211 | 211 | // configuration adjustments for 'dev' environment |
212 | - $config['bootstrap'][] = 'debug'; |
|
213 | - $config['modules']['debug'] = [ |
|
212 | + $config[ 'bootstrap' ][ ] = 'debug'; |
|
213 | + $config[ 'modules' ][ 'debug' ] = [ |
|
214 | 214 | 'class' => 'yii\debug\Module', |
215 | 215 | // uncomment the following to add your IP if you are not connecting from localhost. |
216 | - 'allowedIPs' => ['127.0.0.1', '::1', '*'], |
|
216 | + 'allowedIPs' => [ '127.0.0.1', '::1', '*' ], |
|
217 | 217 | ]; |
218 | 218 | |
219 | - $config['bootstrap'][] = 'gii'; |
|
220 | - $config['modules']['gii'] = [ |
|
219 | + $config[ 'bootstrap' ][ ] = 'gii'; |
|
220 | + $config[ 'modules' ][ 'gii' ] = [ |
|
221 | 221 | 'class' => 'yii\gii\Module', |
222 | 222 | // uncomment the following to add your IP if you are not connecting from localhost. |
223 | - 'allowedIPs' => ['127.0.0.1', '::1', '*'], |
|
223 | + 'allowedIPs' => [ '127.0.0.1', '::1', '*' ], |
|
224 | 224 | ]; |
225 | 225 | } |
226 | 226 |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | protected function getAdditionFields(): array |
100 | 100 | { |
101 | 101 | if ($this->action->id == 'create' || $this->action->id == 'update') { |
102 | - $fields = []; |
|
102 | + $fields = [ ]; |
|
103 | 103 | |
104 | - $fields['pages'] = Page::getMenu(); |
|
105 | - $fields['albums'] = Album::find()->select([ |
|
104 | + $fields[ 'pages' ] = Page::getMenu(); |
|
105 | + $fields[ 'albums' ] = Album::find()->select([ |
|
106 | 106 | 'id', 'title' |
107 | 107 | ])->all(); |
108 | 108 | |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | 'defaultPageSize' => 6, |
117 | 117 | 'totalCount' => $mediafilesQuery->count() |
118 | 118 | ]); |
119 | - $fields['images'] = $mediafilesQuery->offset($media_pages->offset) |
|
119 | + $fields[ 'images' ] = $mediafilesQuery->offset($media_pages->offset) |
|
120 | 120 | ->limit($media_pages->limit) |
121 | 121 | ->all(); |
122 | - $fields['media_pages'] = $media_pages; |
|
122 | + $fields[ 'media_pages' ] = $media_pages; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $fields; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | - public function getDefaultThumbImage(array $options = []) |
|
29 | + public function getDefaultThumbImage(array $options = [ ]) |
|
30 | 30 | { |
31 | 31 | $thumbnailModel = $this->getThumbnailModel(); |
32 | 32 | |
33 | - if (null === $thumbnailModel){ |
|
33 | + if (null === $thumbnailModel) { |
|
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | return null; |
41 | 41 | } |
42 | 42 | |
43 | - if (empty($options['alt'])) { |
|
44 | - $options['alt'] = $thumbnailModel->alt; |
|
43 | + if (empty($options[ 'alt' ])) { |
|
44 | + $options[ 'alt' ] = $thumbnailModel->alt; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return Html::img($url, $options); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'exist', |
138 | 138 | 'skipOnError' => true, |
139 | 139 | 'targetClass' => Position::class, |
140 | - 'targetAttribute' => ['position_id' => 'id'] |
|
140 | + 'targetAttribute' => [ 'position_id' => 'id' ] |
|
141 | 141 | ], |
142 | 142 | ]; |
143 | 143 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function getFullName(): string |
309 | 309 | { |
310 | - return $this->first_name . ' ' . $this->last_name; |
|
310 | + return $this->first_name.' '.$this->last_name; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function moveOrder(int $order): void |
434 | 434 | { |
435 | - if ($order == $this->order){ |
|
435 | + if ($order == $this->order) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | ]) |
444 | 444 | ->one(); |
445 | 445 | $future->detachBehavior('mediafile'); |
446 | - $future->order = $order > $this->order ? $order-1 : $order+1; |
|
446 | + $future->order = $order > $this->order ? $order - 1 : $order + 1; |
|
447 | 447 | $future->save(); |
448 | 448 | |
449 | 449 | $this->detachBehavior('mediafile'); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | public function beforeSave($insert) |
460 | 460 | { |
461 | - if ($this->isNewRecord){ |
|
461 | + if ($this->isNewRecord) { |
|
462 | 462 | $this->order = $this->maxOrder == null ? 1 : $this->maxOrder + 1; |
463 | 463 | } |
464 | 464 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @var array |
48 | 48 | */ |
49 | - public $albums = []; |
|
49 | + public $albums = [ ]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Initialize. |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | 'exist', |
109 | 109 | 'skipOnError' => true, |
110 | 110 | 'targetClass' => Page::class, |
111 | - 'targetAttribute' => ['pageId' => 'id'] |
|
111 | + 'targetAttribute' => [ 'pageId' => 'id' ] |
|
112 | 112 | ], |
113 | 113 | [ |
114 | 114 | UploadModelInterface::FILE_TYPE_THUMB, |
115 | - function($attribute){ |
|
116 | - if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})){ |
|
115 | + function($attribute) { |
|
116 | + if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})) { |
|
117 | 117 | $this->addError($attribute, 'Tumbnail content must be a numeric or string.'); |
118 | 118 | } |
119 | 119 | }, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | [ |
132 | 132 | 'albums', |
133 | 133 | 'each', |
134 | - 'rule' => ['integer'], |
|
134 | + 'rule' => [ 'integer' ], |
|
135 | 135 | ], |
136 | 136 | ]; |
137 | 137 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - public $albums = []; |
|
44 | + public $albums = [ ]; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var int |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | ], |
102 | 102 | [ |
103 | 103 | UploadModelInterface::FILE_TYPE_THUMB, |
104 | - function($attribute){ |
|
105 | - if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})){ |
|
104 | + function($attribute) { |
|
105 | + if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})) { |
|
106 | 106 | $this->addError($attribute, 'Tumbnail content must be a numeric or string.'); |
107 | 107 | } |
108 | 108 | }, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | [ |
112 | 112 | 'albums', |
113 | 113 | 'each', |
114 | - 'rule' => ['integer'], |
|
114 | + 'rule' => [ 'integer' ], |
|
115 | 115 | ], |
116 | 116 | ]; |
117 | 117 | } |