| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| 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 |
||
| 59 | ], $response); |
||
| 60 | } |
||
| 61 | |||
| 62 | public function configureCreateForm(FormMapper $form, BlockInterface $block): void |
||
| 63 | { |
||
| 64 | $this->configureEditForm($form, $block); |
||
| 65 | } |
||
| 66 | |||
| 67 | public function configureEditForm(FormMapper $formMapper, BlockInterface $block): void |
||
| 68 | { |
||
| 69 | $formMapper->add('settings', ImmutableArrayType::class, [ |
||
| 70 | 'keys' => [ |
||
| 71 | ['title', TextType::class, [ |
||
| 72 | 'required' => false, |
||
| 73 | 'label' => 'form.label_title', |
||
| 74 | ]], |
||
| 75 | ['translation_domain', TextType::class, [ |
||
| 76 | 'label' => 'form.label_translation_domain', |
||
| 77 | 'required' => false, |
||
| 78 | ]], |
||
| 79 | ['icon', TextType::class, [ |
||
| 80 | 'label' => 'form.label_icon', |
||
| 81 | 'required' => false, |
||
| 82 | ]], |
||
| 83 | ['class', TextType::class, [ |
||
| 84 | 'label' => 'form.label_class', |
||
| 85 | 'required' => false, |
||
| 86 | ]], |
||
| 87 | ['host', TextType::class, [ |
||
| 88 | 'required' => false, |
||
| 89 | 'label' => 'form.label_host', |
||
| 90 | ]], |
||
| 91 | ['token', TextType::class, [ |
||
| 92 | 'required' => false, |
||
| 93 | 'label' => 'form.label_token', |
||
| 94 | ]], |
||
| 95 | ['site', NumberType::class, [ |
||
| 96 | 'label' => 'form.label_site', |
||
| 97 | ]], |
||
| 98 | ['method', ChoiceType::class, [ |
||
| 99 | 'choices' => [ |
||
| 100 | 'form.choice_visitors' => 'VisitsSummary.getVisits', |
||
| 101 | 'form.choice_unique_visitors' => 'VisitsSummary.getUniqueVisitors', |
||
| 102 | 'form.choice_hits' => 'VisitsSummary.getActions ', |
||
| 103 | ], |
||
| 104 | 'label' => 'form.label_method', |
||
| 105 | ]], |
||
| 106 | ['period', ChoiceType::class, [ |
||
| 107 | 'choices' => [ |
||
| 108 | 'form.choice_day' => 'day', |
||
| 109 | 'form.choice_week' => 'week', |
||
| 110 | 'form.choice_month' => 'month', |
||
| 111 | 'form.choice_year' => 'year', |
||
| 112 | ], |
||
| 113 | 'label' => 'form.label_period', |
||
| 114 | ]], |
||
| 115 | ['date', ChoiceType::class, [ |
||
| 116 | 'choices' => [ |
||
| 117 | 'form.choice_today' => 'last1', |
||
| 118 | 'form.choice_1_week' => 'last7', |
||
| 119 | 'form.choice_2_weeks' => 'last14', |
||
| 120 | 'form.choice_1_month' => 'last30', |
||
| 121 | 'form.choice_3_months' => 'last90', |
||
| 122 | 'form.choice_6_months' => 'last180', |
||
| 123 | 'form.choice_1_year' => 'last360', |
||
| 185 |