| Conditions | 1 |
| Paths | 1 |
| Total Lines | 82 |
| Code Lines | 58 |
| 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 |
||
| 32 | public function dataOptions(): array |
||
| 33 | { |
||
| 34 | return [ |
||
| 35 | [ |
||
| 36 | new Length(min: 3), |
||
| 37 | [ |
||
| 38 | 'min' => 3, |
||
| 39 | 'max' => null, |
||
| 40 | 'exactly' => null, |
||
| 41 | 'lessThanMinMessage' => [ |
||
| 42 | 'template' => 'This value must contain at least {min, number} {min, plural, one{character} other{characters}}.', |
||
| 43 | 'parameters' => ['min' => 3], |
||
| 44 | ], |
||
| 45 | 'greaterThanMaxMessage' => [ |
||
| 46 | 'template' => 'This value must contain at most {max, number} {max, plural, one{character} other{characters}}.', |
||
| 47 | 'parameters' => ['max' => null], |
||
| 48 | ], |
||
| 49 | 'notExactlyMessage' => [ |
||
| 50 | 'template' => 'This value must contain exactly {exactly, number} {exactly, plural, one{character} other{characters}}.', |
||
| 51 | 'parameters' => ['exactly' => null], |
||
| 52 | ], |
||
| 53 | 'incorrectInputMessage' => [ |
||
| 54 | 'template' => 'This value must be a string.', |
||
| 55 | 'parameters' => [], |
||
| 56 | ], |
||
| 57 | 'encoding' => 'UTF-8', |
||
| 58 | 'skipOnEmpty' => false, |
||
| 59 | 'skipOnError' => false, |
||
| 60 | ], |
||
| 61 | ], |
||
| 62 | [ |
||
| 63 | new Length(max: 3), |
||
| 64 | [ |
||
| 65 | 'min' => null, |
||
| 66 | 'max' => 3, |
||
| 67 | 'exactly' => null, |
||
| 68 | 'lessThanMinMessage' => [ |
||
| 69 | 'template' => 'This value must contain at least {min, number} {min, plural, one{character} other{characters}}.', |
||
| 70 | 'parameters' => ['min' => null], |
||
| 71 | ], |
||
| 72 | 'greaterThanMaxMessage' => [ |
||
| 73 | 'template' => 'This value must contain at most {max, number} {max, plural, one{character} other{characters}}.', |
||
| 74 | 'parameters' => ['max' => 3], |
||
| 75 | ], |
||
| 76 | 'notExactlyMessage' => [ |
||
| 77 | 'template' => 'This value must contain exactly {exactly, number} {exactly, plural, one{character} other{characters}}.', |
||
| 78 | 'parameters' => ['exactly' => null], |
||
| 79 | ], |
||
| 80 | 'incorrectInputMessage' => [ |
||
| 81 | 'template' => 'This value must be a string.', |
||
| 82 | 'parameters' => [], |
||
| 83 | ], |
||
| 84 | 'encoding' => 'UTF-8', |
||
| 85 | 'skipOnEmpty' => false, |
||
| 86 | 'skipOnError' => false, |
||
| 87 | ], |
||
| 88 | ], |
||
| 89 | [ |
||
| 90 | new Length(min: 3, max: 4, encoding: 'windows-1251'), |
||
| 91 | [ |
||
| 92 | 'min' => 3, |
||
| 93 | 'max' => 4, |
||
| 94 | 'exactly' => null, |
||
| 95 | 'lessThanMinMessage' => [ |
||
| 96 | 'template' => 'This value must contain at least {min, number} {min, plural, one{character} other{characters}}.', |
||
| 97 | 'parameters' => ['min' => 3], |
||
| 98 | ], |
||
| 99 | 'greaterThanMaxMessage' => [ |
||
| 100 | 'template' => 'This value must contain at most {max, number} {max, plural, one{character} other{characters}}.', |
||
| 101 | 'parameters' => ['max' => 4], |
||
| 102 | ], |
||
| 103 | 'notExactlyMessage' => [ |
||
| 104 | 'template' => 'This value must contain exactly {exactly, number} {exactly, plural, one{character} other{characters}}.', |
||
| 105 | 'parameters' => ['exactly' => null], |
||
| 106 | ], |
||
| 107 | 'incorrectInputMessage' => [ |
||
| 108 | 'template' => 'This value must be a string.', |
||
| 109 | 'parameters' => [], |
||
| 110 | ], |
||
| 111 | 'encoding' => 'windows-1251', |
||
| 112 | 'skipOnEmpty' => false, |
||
| 113 | 'skipOnError' => false, |
||
| 114 | ], |
||
| 279 |