Conditions | 7 |
Paths | 32 |
Total Lines | 90 |
Code Lines | 49 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
24 | protected function configureFormFields(FormMapper $formMapper): void |
||
25 | { |
||
26 | |||
27 | $now = new \DateTime(); |
||
28 | |||
29 | $formMapper |
||
30 | ->with('admin.user.label.id', ['class' => 'col-md-4']) |
||
31 | //->add('username') |
||
32 | ->add('email', null, [ |
||
33 | 'label' => 'admin.user.email.label', |
||
34 | ]) |
||
35 | ->add('plainPassword', TextType::class, [ |
||
36 | 'required' => (!$this->getSubject() || null === $this->getSubject()->getId()), |
||
37 | 'label' => 'admin.user.password.label', |
||
38 | ]) |
||
39 | ->end() |
||
40 | ; |
||
41 | |||
42 | $formMapper |
||
43 | ->with('admin.user.label.profile', ['class' => 'col-md-4']) |
||
44 | ; |
||
45 | |||
46 | if (method_exists($this->getConfigurationPool()->getContainer()->getParameter('app.entity_user'), 'getDateOfBirth')) { |
||
47 | $formMapper->add('dateOfBirth', DatePickerType::class, [ |
||
48 | 'years' => range(1900, $now->format('Y')), |
||
49 | 'dp_min_date' => '1-1-1900', |
||
50 | 'dp_max_date' => $now->format('c'), |
||
51 | 'required' => false, |
||
52 | 'label' => 'admin.user.dateOfBirth.label', |
||
53 | ]); |
||
54 | } |
||
55 | if (method_exists($this->getConfigurationPool()->getContainer()->getParameter('app.entity_user'), 'getfirstname')) { |
||
56 | $formMapper->add('firstname', TextType::class, [ |
||
57 | 'required' => false, |
||
58 | 'label' => 'admin.user.firstname.label', |
||
59 | ]); |
||
60 | } |
||
61 | if (method_exists($this->getConfigurationPool()->getContainer()->getParameter('app.entity_user'), 'getlastname')) { |
||
62 | $formMapper->add('lastname', TextType::class, [ |
||
63 | 'required' => false, |
||
64 | 'label' => 'admin.user.lastname.label', |
||
65 | ]); |
||
66 | } |
||
67 | if (method_exists($this->getConfigurationPool()->getContainer()->getParameter('app.entity_user'), 'getcity')) { |
||
68 | $formMapper->add('city', TextType::class, [ |
||
69 | 'required' => false, |
||
70 | 'label' => 'admin.user.city.label', |
||
71 | ]); |
||
72 | } |
||
73 | if (method_exists($this->getConfigurationPool()->getContainer()->getParameter('app.entity_user'), 'getphone')) { |
||
74 | $formMapper->add('phone', TextType::class, [ |
||
75 | 'required' => false, |
||
76 | 'label' => 'admin.user.phone.label', |
||
77 | ]); |
||
78 | } |
||
79 | |||
80 | $formMapper->end() |
||
81 | |||
82 | ->with('admin.user.label.security', ['class' => 'col-md-4']) |
||
83 | ->add('enabled', null, [ |
||
84 | 'required' => false, |
||
85 | 'label' => 'admin.user.enabled.label', |
||
86 | ]) |
||
87 | |||
88 | /* |
||
89 | ->with('Groups') |
||
90 | ->add('groups', ModelType::class, [ |
||
91 | 'required' => false, |
||
92 | 'expanded' => true, |
||
93 | 'multiple' => true, |
||
94 | ]) |
||
95 | ->end() |
||
96 | */ |
||
97 | |||
98 | ->add('roles', ImmutableArrayType::class, [ |
||
99 | 'label' => false, |
||
100 | 'keys' => [ |
||
101 | ['0', ChoiceType::class, [ |
||
102 | 'required' => false, |
||
103 | 'label' => 'admin.user.role.label', |
||
104 | 'choices' => [ |
||
105 | 'admin.user.role.admin' => 'ROLE_SUPER_ADMIN', |
||
106 | 'admin.user.role.user' => 'ROLE_USER', |
||
107 | ], |
||
108 | ]], |
||
109 | ], |
||
110 | ]) |
||
111 | |||
112 | |||
113 | ->end() |
||
114 | ; |
||
170 |
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