| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 57 | 
| 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 | ||
| 116 | protected function configureOptions(OptionsResolver $resolver): void | ||
| 117 |     { | ||
| 118 | $resolver | ||
| 119 |             ->setDefault('name', function (Options $options): string { | ||
|  | |||
| 120 | return $this->faker->words(3, true); | ||
| 121 | }) | ||
| 122 |             ->setDefault('code', function (Options $options): string { | ||
| 123 | return StringInflector::nameToCode($options['name']); | ||
| 124 | }) | ||
| 125 |             ->setDefault('hostname', function (Options $options): string { | ||
| 126 | return $options['code'] . '.localhost'; | ||
| 127 | }) | ||
| 128 |             ->setDefault('color', function (Options $options): string { | ||
| 129 | return $this->faker->colorName; | ||
| 130 | }) | ||
| 131 |             ->setDefault('enabled', function (Options $options): bool { | ||
| 132 | return $this->faker->boolean(90); | ||
| 133 | }) | ||
| 134 |             ->setAllowedTypes('enabled', 'bool') | ||
| 135 |             ->setDefault('skipping_shipping_step_allowed', false) | ||
| 136 |             ->setAllowedTypes('skipping_shipping_step_allowed', 'bool') | ||
| 137 |             ->setDefault('skipping_payment_step_allowed', false) | ||
| 138 |             ->setAllowedTypes('skipping_payment_step_allowed', 'bool') | ||
| 139 |             ->setDefault('account_verification_required', true) | ||
| 140 |             ->setAllowedTypes('account_verification_required', 'bool') | ||
| 141 | ->setDefault( | ||
| 142 | 'default_tax_zone', | ||
| 143 | LazyOption::randomOneOrNull($this->zoneRepository, 100, ['scope' => [Scope::TAX, AddressingScope::ALL]]) | ||
| 144 | ) | ||
| 145 |             ->setAllowedTypes('default_tax_zone', ['null', 'string', ZoneInterface::class]) | ||
| 146 | ->setNormalizer( | ||
| 147 | 'default_tax_zone', | ||
| 148 | LazyOption::findOneBy($this->zoneRepository, 'code', ['scope' => [Scope::TAX, AddressingScope::ALL]]) | ||
| 149 | ) | ||
| 150 |             ->setDefault('tax_calculation_strategy', 'order_items_based') | ||
| 151 |             ->setAllowedTypes('tax_calculation_strategy', 'string') | ||
| 152 |             ->setDefault('default_locale', function (Options $options): LocaleInterface { | ||
| 153 | return $this->faker->randomElement($options['locales']); | ||
| 154 | }) | ||
| 155 |             ->setAllowedTypes('default_locale', ['string', LocaleInterface::class]) | ||
| 156 |             ->setNormalizer('default_locale', LazyOption::findOneBy($this->localeRepository, 'code')) | ||
| 157 |             ->setDefault('locales', LazyOption::all($this->localeRepository)) | ||
| 158 |             ->setAllowedTypes('locales', 'array') | ||
| 159 |             ->setNormalizer('locales', LazyOption::findBy($this->localeRepository, 'code')) | ||
| 160 |             ->setDefault('base_currency', function (Options $options): CurrencyInterface { | ||
| 161 | return $this->faker->randomElement($options['currencies']); | ||
| 162 | }) | ||
| 163 |             ->setAllowedTypes('base_currency', ['string', CurrencyInterface::class]) | ||
| 164 |             ->setNormalizer('base_currency', LazyOption::findOneBy($this->currencyRepository, 'code')) | ||
| 165 |             ->setDefault('currencies', LazyOption::all($this->currencyRepository)) | ||
| 166 |             ->setAllowedTypes('currencies', 'array') | ||
| 167 |             ->setNormalizer('currencies', LazyOption::findBy($this->currencyRepository, 'code')) | ||
| 168 |             ->setDefault('theme_name', null) | ||
| 169 |             ->setDefault('contact_email', null) | ||
| 170 |             ->setDefault('shop_billing_data', null) | ||
| 171 | ; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.