| Conditions | 1 |
| Paths | 1 |
| Total Lines | 95 |
| Code Lines | 56 |
| 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 |
||
| 46 | public function dataProviderForTestFormat() |
||
| 47 | { |
||
| 48 | return [ |
||
| 49 | [ |
||
| 50 | ['streetNumber' => '10'], |
||
| 51 | '%n', |
||
| 52 | '10', |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | ['streetName' => 'Via San Marco'], |
||
| 56 | '%S', |
||
| 57 | 'Via San Marco', |
||
| 58 | ], |
||
| 59 | [ |
||
| 60 | ['locality' => 'Zuerich'], |
||
| 61 | '%L', |
||
| 62 | 'Zuerich', |
||
| 63 | ], |
||
| 64 | [ |
||
| 65 | ['postalCode' => '8001'], |
||
| 66 | '%z', |
||
| 67 | '8001', |
||
| 68 | ], |
||
| 69 | [ |
||
| 70 | ['adminLevels' => [['name' => 'Collin County', 'level' => 2]]], |
||
| 71 | '%A2', |
||
| 72 | 'Collin County', |
||
| 73 | ], |
||
| 74 | [ |
||
| 75 | ['adminLevels' => [['code' => 'FC', 'level' => 2]]], |
||
| 76 | '%a2', |
||
| 77 | 'FC', |
||
| 78 | ], |
||
| 79 | [ |
||
| 80 | ['adminLevels' => [['name' => 'Auvergne', 'level' => 1]]], |
||
| 81 | '%A1', |
||
| 82 | 'Auvergne', |
||
| 83 | ], |
||
| 84 | [ |
||
| 85 | ['adminLevels' => [['code' => 'CA', 'level' => 1]]], |
||
| 86 | '%a1', |
||
| 87 | 'CA', |
||
| 88 | ], |
||
| 89 | [ |
||
| 90 | ['country' => 'France'], |
||
| 91 | '%C', |
||
| 92 | 'France', |
||
| 93 | ], |
||
| 94 | [ |
||
| 95 | ['countryCode' => 'fr'], |
||
| 96 | '%c', |
||
| 97 | 'FR', |
||
| 98 | ], |
||
| 99 | [ |
||
| 100 | ['timezone' => 'Europe/Paris'], |
||
| 101 | '%T', |
||
| 102 | 'Europe/Paris', |
||
| 103 | ], |
||
| 104 | [ |
||
| 105 | ['subLocality' => 'District'], |
||
| 106 | '%D', |
||
| 107 | 'District', |
||
| 108 | ], |
||
| 109 | [ |
||
| 110 | [ |
||
| 111 | 'streetNumber' => '120', |
||
| 112 | 'streetName' => 'Badenerstrasse', |
||
| 113 | 'postalCode' => '8001', |
||
| 114 | 'locality' => 'Zuerich', |
||
| 115 | ], |
||
| 116 | '%S %n, %z %L', |
||
| 117 | 'Badenerstrasse 120, 8001 Zuerich', |
||
| 118 | ], |
||
| 119 | [ |
||
| 120 | [ |
||
| 121 | 'streetNumber' => '120', |
||
| 122 | 'streetName' => 'Badenerstrasse', |
||
| 123 | 'postalCode' => '8001', |
||
| 124 | 'locality' => 'Zuerich', |
||
| 125 | ], |
||
| 126 | '<p>%S %n, %z <a href="#%L">%L</a></p>', |
||
| 127 | '<p>Badenerstrasse 120, 8001 <a href="#Zuerich">Zuerich</a></p>', |
||
| 128 | ], |
||
| 129 | [ |
||
| 130 | [ |
||
| 131 | 'streetNumber' => '120', |
||
| 132 | 'streetName' => 'Badenerstrasse', |
||
| 133 | 'postalCode' => '8001', |
||
| 134 | 'locality' => 'Zuerich', |
||
| 135 | ], |
||
| 136 | '<p>%S %n, %z <a href="#%L">%L</a></p><p>%A2</p>', |
||
| 137 | '<p>Badenerstrasse 120, 8001 <a href="#Zuerich">Zuerich</a></p><p></p>', |
||
| 138 | ], |
||
| 139 | ]; |
||
| 140 | } |
||
| 141 | } |
||
| 142 |