Conditions | 1 |
Paths | 1 |
Total Lines | 185 |
Code Lines | 134 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
135 | public function behaviors() |
||
136 | { |
||
137 | $filesSource = new DropDown([ |
||
138 | 'attribute' => 'import_files_source_id', |
||
139 | 'relation' => 'filesSource', |
||
140 | 'required' => true, |
||
141 | ]); |
||
142 | $standardFields = $this->getStandardFields(['visible'], [ |
||
143 | 'ignored_lines' => [ |
||
144 | 'class' => NumberField::class, |
||
145 | 'attribute' => 'ignored_lines', |
||
146 | 'required' => true, |
||
147 | ], |
||
148 | 'is_check_mime_type' => [ |
||
149 | 'class' => Boolean::class, |
||
150 | 'attribute' => 'is_check_mime_type', |
||
151 | ], |
||
152 | 'import_files_source_id' => $filesSource, |
||
153 | 'import_files_encoding_id' => [ |
||
154 | 'class' => DropDown::class, |
||
155 | 'attribute' => 'import_files_encoding_id', |
||
156 | 'relation' => 'filesEncoding', |
||
157 | 'required' => true, |
||
158 | ], |
||
159 | ]); |
||
160 | |||
161 | |||
162 | $emailTarget = new Target($filesSource); |
||
163 | // $emailTarget->setValues([ |
||
164 | // function () { |
||
165 | // return FilesSource::getIdByKey(FilesSource::TYPE_EMAIL); |
||
166 | // } |
||
167 | // ]); |
||
168 | |||
169 | $reloader = new Reloader(new Dependent(), [$emailTarget]); |
||
170 | $emailGroup = new Group([ |
||
171 | 'label' => 'Настройки Email', |
||
172 | 'reloaders' => [$reloader], |
||
173 | 'name' => 'emailGroup', |
||
174 | ]); |
||
175 | |||
176 | $standardFields = ArrayHelper::merge($standardFields, [ |
||
177 | 'emailGroup' => $emailGroup, |
||
178 | 'email' => [ |
||
179 | 'class' => Email::class, |
||
180 | 'attribute' => 'email', |
||
181 | 'reloaders' => [$reloader], |
||
182 | ], |
||
183 | 'email_title_match' => [ |
||
184 | 'attribute' => 'email_title_match', |
||
185 | 'reloaders' => [$reloader], |
||
186 | ], |
||
187 | 'email_attachment_template' => [ |
||
188 | 'attribute' => 'email_attachment_template', |
||
189 | 'reloaders' => [$reloader], |
||
190 | ], |
||
191 | ]); |
||
192 | |||
193 | $standardFields = ArrayHelper::merge($standardFields, [ |
||
194 | 'csvGroup' => [ |
||
195 | 'class' => Group::class, |
||
196 | 'label' => 'Настройки Csv', |
||
197 | 'reloaders' => [$reloader], |
||
198 | 'name' => 'csvGroup', |
||
199 | ], |
||
200 | 'csv_delimiter' => [ |
||
201 | 'attribute' => 'csv_delimiter', |
||
202 | 'reloaders' => [$reloader], |
||
203 | ], |
||
204 | 'csv_enclosure' => [ |
||
205 | 'attribute' => 'csv_enclosure', |
||
206 | 'reloaders' => [$reloader], |
||
207 | ], |
||
208 | 'ftpGroup' => [ |
||
209 | 'class' => Group::class, |
||
210 | 'label' => 'Настройки FTP', |
||
211 | 'reloaders' => [$reloader], |
||
212 | 'name' => 'ftpGroup', |
||
213 | ], |
||
214 | 'ftp_host' => [ |
||
215 | 'attribute' => 'ftp_host', |
||
216 | 'reloaders' => [$reloader], |
||
217 | ], |
||
218 | 'ftp_ssl' => [ |
||
219 | 'class' => Boolean::class, |
||
220 | 'attribute' => 'ftp_ssl', |
||
221 | 'defaultValue' => false, |
||
222 | 'reloaders' => [$reloader], |
||
223 | ], |
||
224 | 'ftp_port' => [ |
||
225 | 'attribute' => 'ftp_port', |
||
226 | 'reloaders' => [$reloader], |
||
227 | ], |
||
228 | 'ftp_timeout' => [ |
||
229 | 'attribute' => 'ftp_timeout', |
||
230 | 'reloaders' => [$reloader], |
||
231 | ], |
||
232 | 'ftp_login' => [ |
||
233 | 'attribute' => 'ftp_login', |
||
234 | 'reloaders' => [$reloader], |
||
235 | ], |
||
236 | 'ftp_password' => [ |
||
237 | 'attribute' => 'ftp_password', |
||
238 | 'reloaders' => [$reloader], |
||
239 | ], |
||
240 | 'ftp_dir' => [ |
||
241 | 'attribute' => 'ftp_dir', |
||
242 | 'reloaders' => [$reloader], |
||
243 | ], |
||
244 | 'ftp_file_name' => [ |
||
245 | 'attribute' => 'ftp_file_name', |
||
246 | 'reloaders' => [$reloader], |
||
247 | ], |
||
248 | 'siteSettingsGroup' => [ |
||
249 | 'class' => Group::class, |
||
250 | 'label' => 'Настройки Сайта', |
||
251 | 'name' => 'siteSettingsGroup', |
||
252 | 'reloaders' => [$reloader], |
||
253 | ], |
||
254 | 'site_host' => [ |
||
255 | 'attribute' => 'site_host', |
||
256 | 'reloaders' => [$reloader], |
||
257 | ], |
||
258 | 'site_auth_url' => [ |
||
259 | 'attribute' => 'site_auth_url', |
||
260 | 'reloaders' => [$reloader], |
||
261 | ], |
||
262 | 'site_auth_method' => [ |
||
263 | 'attribute' => 'site_auth_method', |
||
264 | 'reloaders' => [$reloader], |
||
265 | ], |
||
266 | 'site_login_field' => [ |
||
267 | 'attribute' => 'site_login_field', |
||
268 | 'reloaders' => [$reloader], |
||
269 | ], |
||
270 | 'site_password_field' => [ |
||
271 | 'attribute' => 'site_password_field', |
||
272 | 'reloaders' => [$reloader], |
||
273 | ], |
||
274 | 'site_other_fields' => [ |
||
275 | 'attribute' => 'site_other_fields', |
||
276 | 'reloaders' => [$reloader], |
||
277 | ], |
||
278 | 'site_login' => [ |
||
279 | 'attribute' => 'site_login', |
||
280 | 'reloaders' => [$reloader], |
||
281 | ], |
||
282 | 'site_password' => [ |
||
283 | 'attribute' => 'site_password', |
||
284 | 'reloaders' => [$reloader], |
||
285 | ], |
||
286 | 'site_file_url' => [ |
||
287 | 'attribute' => 'site_file_url', |
||
288 | 'reloaders' => [$reloader], |
||
289 | ], |
||
290 | 'sheetsGroup' => [ |
||
291 | 'class' => Group::class, |
||
292 | 'label' => 'Листы', |
||
293 | ], |
||
294 | 'settingsSheets' => [ |
||
295 | 'class' => HasManyMultipleInput::class, |
||
296 | 'attribute' => 'settingsSheets', |
||
297 | 'relation' => 'settingsSheets', |
||
298 | 'column' => false, |
||
299 | ], |
||
300 | ]); |
||
301 | |||
302 | return [ |
||
303 | 'relationsSaver' => [ |
||
304 | 'class' => SaveRelationsBehavior::class, |
||
305 | 'relations' => [ |
||
306 | 'settingsSheets' |
||
307 | ], |
||
308 | ], |
||
309 | 'fields' => [ |
||
310 | 'class' => Behavior::class, |
||
311 | 'module' => 'import', |
||
312 | 'fields' => $standardFields, |
||
313 | 'plugins' => \yii::$app->getModule('import')->getSettingsCrudFieldsPlugins(), |
||
314 | ], |
||
315 | 'date' => [ |
||
316 | 'class' => TimestampBehavior::class, |
||
317 | 'createdAtAttribute' => 'created', |
||
318 | 'updatedAtAttribute' => 'updated', |
||
319 | 'value' => new Expression('NOW()'), |
||
320 | ], |
||
388 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths