| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 45 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 94 | public function configureFields(string $pageName): iterable |
||
| 95 | { |
||
| 96 | return [ |
||
| 97 | //Basic info |
||
| 98 | IntegerField::new('id', 'user.id.label') |
||
| 99 | ->hideOnForm(), |
||
| 100 | TextField::new('username', 'user.username.label'), |
||
| 101 | TextField::new('fullName', 'user.fullName.label') |
||
| 102 | ->onlyOnIndex(), |
||
| 103 | TextField::new('first_name', 'user.first_name.label') |
||
| 104 | ->setRequired(false) |
||
| 105 | ->setFormTypeOption('empty_data', '') |
||
| 106 | ->hideOnIndex(), |
||
| 107 | TextField::new('last_name', 'user.last_name.label') |
||
| 108 | ->setRequired(false) |
||
| 109 | ->setFormTypeOption('empty_data', '') |
||
| 110 | ->hideOnIndex(), |
||
| 111 | EmailField::new('email', 'user.email.label') |
||
| 112 | ->setRequired(false) |
||
| 113 | ->setFormTypeOption('empty_data', ''), |
||
| 114 | TextField::new('role_description', 'user.role_description.label') |
||
| 115 | ->setRequired(false) |
||
| 116 | ->setFormTypeOption('empty_data', ''), |
||
| 117 | BooleanField::new('disabled', 'user.disabled.label') |
||
| 118 | ->setRequired(false) |
||
| 119 | ->renderAsSwitch(false) |
||
| 120 | ->hideOnIndex(), |
||
| 121 | BooleanField::new('password_change_needed', 'user.password_change_needed.label') |
||
| 122 | ->setRequired(false) |
||
| 123 | ->renderAsSwitch(false) |
||
| 124 | ->hideOnIndex(), |
||
| 125 | |||
| 126 | ChoiceField::new('roles', 'user.roles.label') |
||
| 127 | ->allowMultipleChoices() |
||
| 128 | ->setChoices(self::USER_ROLE_CHOICES) |
||
| 129 | ->renderExpanded() |
||
| 130 | ->renderAsNativeWidget() |
||
| 131 | ->hideOnIndex(), |
||
| 132 | |||
| 133 | //Passowrd panel |
||
| 134 | FormField::addPanel('user.section.password') |
||
| 135 | ->setHelp('user.section.password.help') |
||
| 136 | ->onlyOnForms(), |
||
| 137 | PasswordField::new('plain_password') |
||
| 138 | ->setRequired(Crud::PAGE_NEW === $pageName) |
||
| 139 | ->onlyOnForms(), |
||
| 140 | |||
| 141 | //2FA panel |
||
| 142 | FormField::addPanel('user.section.tfa')->setHelp('user.section.tfa.help'), |
||
| 143 | BooleanField::new('tfa_enabled', 'user.tfa_enabled.label') |
||
| 144 | ->setHelp('user.tfa_enabled.help') |
||
| 145 | ->renderAsSwitch(false) |
||
| 146 | ->setFormTypeOption('disabled', true), |
||
| 147 | ]; |
||
| 171 |
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