@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | return [ |
21 | 21 | [ |
22 | - ['id'], |
|
22 | + [ 'id' ], |
|
23 | 23 | 'integer', |
24 | 24 | ], |
25 | 25 | [ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - public $quantity = []; |
|
36 | + public $quantity = [ ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * {@inheritdoc} |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | [ |
53 | 53 | 'quantity', |
54 | 54 | 'each', |
55 | - 'rule' => ['integer'], |
|
55 | + 'rule' => [ 'integer' ], |
|
56 | 56 | ], |
57 | 57 | [ |
58 | 58 | [ |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
101 | - $products = Product::find()->where(['in', 'id', array_keys($this->quantity)])->select(['id', 'alias', 'title', 'price'])->all(); |
|
101 | + $products = Product::find()->where([ 'in', 'id', array_keys($this->quantity) ])->select([ 'id', 'alias', 'title', 'price' ])->all(); |
|
102 | 102 | |
103 | 103 | return Yii::$app->mailer->compose('order', [ |
104 | 104 | 'header' => Yii::t('order', 'New client'), |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | 'baseUrl' => Yii::$app->homeUrl |
112 | 112 | ]) |
113 | 113 | ->setTo($email) |
114 | - ->setFrom([$this->email => $this->name]) |
|
115 | - ->setSubject(Yii::t('order', 'New order in {project_name} site.', ['project_name' => Yii::$app->params['project_name']])) |
|
114 | + ->setFrom([ $this->email => $this->name ]) |
|
115 | + ->setSubject(Yii::t('order', 'New order in {project_name} site.', [ 'project_name' => Yii::$app->params[ 'project_name' ] ])) |
|
116 | 116 | ->send(); |
117 | 117 | } |
118 | 118 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'language_id' |
83 | 83 | ], |
84 | 84 | 'unique', |
85 | - 'targetAttribute' => ['articles_id', 'language_id'] |
|
85 | + 'targetAttribute' => [ 'articles_id', 'language_id' ] |
|
86 | 86 | ], |
87 | 87 | [ |
88 | 88 | [ |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'exist', |
92 | 92 | 'skipOnError' => true, |
93 | 93 | 'targetClass' => Language::class, |
94 | - 'targetAttribute' => ['language_id' => 'id'] |
|
94 | + 'targetAttribute' => [ 'language_id' => 'id' ] |
|
95 | 95 | ], |
96 | 96 | [ |
97 | 97 | [ |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'exist', |
101 | 101 | 'skipOnError' => true, |
102 | 102 | 'targetClass' => Article::class, |
103 | - 'targetAttribute' => ['articles_id' => 'id'] |
|
103 | + 'targetAttribute' => [ 'articles_id' => 'id' ] |
|
104 | 104 | ], |
105 | 105 | ]; |
106 | 106 | } |
@@ -77,18 +77,18 @@ |
||
77 | 77 | 'max' => 255, |
78 | 78 | ], |
79 | 79 | [ |
80 | - ['categories_id'], |
|
80 | + [ 'categories_id' ], |
|
81 | 81 | 'exist', |
82 | 82 | 'skipOnError' => true, |
83 | 83 | 'targetClass' => Category::class, |
84 | - 'targetAttribute' => ['categories_id' => 'id'], |
|
84 | + 'targetAttribute' => [ 'categories_id' => 'id' ], |
|
85 | 85 | ], |
86 | 86 | [ |
87 | - ['language_id'], |
|
87 | + [ 'language_id' ], |
|
88 | 88 | 'exist', |
89 | 89 | 'skipOnError' => true, |
90 | 90 | 'targetClass' => Language::class, |
91 | - 'targetAttribute' => ['language_id' => 'id'], |
|
91 | + 'targetAttribute' => [ 'language_id' => 'id' ], |
|
92 | 92 | ], |
93 | 93 | ]; |
94 | 94 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | [ |
73 | 73 | 'parentId', |
74 | 74 | 'filter', |
75 | - 'filter' => function ($value) { |
|
75 | + 'filter' => function($value) { |
|
76 | 76 | if (empty($value)) { |
77 | 77 | return null; |
78 | 78 | } else { |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | [ |
84 | 84 | 'alias', |
85 | 85 | 'filter', |
86 | - 'filter' => function ($value) { |
|
87 | - return preg_replace( '/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
86 | + 'filter' => function($value) { |
|
87 | + return preg_replace('/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
88 | 88 | } |
89 | 89 | ], |
90 | 90 | [ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - public $albums = []; |
|
53 | + public $albums = [ ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Init albums. |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | [ |
117 | 117 | 'alias', |
118 | 118 | 'filter', |
119 | - 'filter' => function ($value) { |
|
120 | - return preg_replace( '/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
119 | + 'filter' => function($value) { |
|
120 | + return preg_replace('/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
121 | 121 | } |
122 | 122 | ], |
123 | 123 | [ |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | 'exist', |
135 | 135 | 'skipOnError' => true, |
136 | 136 | 'targetClass' => Category::class, |
137 | - 'targetAttribute' => ['categoryId' => 'id'] |
|
137 | + 'targetAttribute' => [ 'categoryId' => 'id' ] |
|
138 | 138 | ], |
139 | 139 | [ |
140 | 140 | UploadModelInterface::FILE_TYPE_THUMB, |
141 | - function($attribute){ |
|
142 | - if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})){ |
|
141 | + function($attribute) { |
|
142 | + if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})) { |
|
143 | 143 | $this->addError($attribute, 'Tumbnail content must be a numeric or string.'); |
144 | 144 | } |
145 | 145 | }, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | [ |
158 | 158 | 'albums', |
159 | 159 | 'each', |
160 | - 'rule' => ['integer'], |
|
160 | + 'rule' => [ 'integer' ], |
|
161 | 161 | ], |
162 | 162 | ]; |
163 | 163 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @var array |
50 | 50 | */ |
51 | - public $albums = []; |
|
51 | + public $albums = [ ]; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Init albums. |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | [ |
106 | 106 | 'parentId', |
107 | 107 | 'filter', |
108 | - 'filter' => function ($value) { |
|
108 | + 'filter' => function($value) { |
|
109 | 109 | if (empty($value)) { |
110 | 110 | return null; |
111 | 111 | } else { |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | [ |
117 | 117 | 'alias', |
118 | 118 | 'filter', |
119 | - 'filter' => function ($value) { |
|
120 | - return preg_replace( '/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
119 | + 'filter' => function($value) { |
|
120 | + return preg_replace('/[^a-z0-9_]+/', '-', strtolower(trim($value))); |
|
121 | 121 | } |
122 | 122 | ], |
123 | 123 | [ |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | ], |
130 | 130 | [ |
131 | 131 | UploadModelInterface::FILE_TYPE_THUMB, |
132 | - function($attribute){ |
|
133 | - if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})){ |
|
132 | + function($attribute) { |
|
133 | + if (!is_numeric($this->{$attribute}) && !is_string($this->{$attribute})) { |
|
134 | 134 | $this->addError($attribute, 'Tumbnail content must be a numeric or string.'); |
135 | 135 | } |
136 | 136 | }, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | [ |
149 | 149 | 'albums', |
150 | 150 | 'each', |
151 | - 'rule' => ['integer'], |
|
151 | + 'rule' => [ 'integer' ], |
|
152 | 152 | ], |
153 | 153 | ]; |
154 | 154 | } |
@@ -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 | } |