| Conditions | 1 |
| Paths | 1 |
| Total Lines | 67 |
| Code Lines | 37 |
| 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 |
||
| 81 | public static function provideIniFilesProvider(): array |
||
| 82 | { |
||
| 83 | return [ |
||
| 84 | [ |
||
| 85 | 'data' => "property = test\nproperty2 = test2\nproperty3 = test3\n", |
||
| 86 | 'expected' => [ |
||
| 87 | 'property' => 'test', |
||
| 88 | 'property2' => 'test2', |
||
| 89 | 'property3' => 'test3', |
||
| 90 | ], |
||
| 91 | ], |
||
| 92 | [ |
||
| 93 | 'data' => "property = test\r\nproperty2 = test2\r\nproperty3 = test3\r\n", |
||
| 94 | 'expected' => [ |
||
| 95 | 'property' => 'test', |
||
| 96 | 'property2' => 'test2', |
||
| 97 | 'property3' => 'test3', |
||
| 98 | ], |
||
| 99 | ], |
||
| 100 | [ |
||
| 101 | 'data' => "property = test,\\\ntest2,\\\ntest3\n", |
||
| 102 | 'expected' => [ |
||
| 103 | 'property' => 'test,test2,test3', |
||
| 104 | ], |
||
| 105 | ], |
||
| 106 | [ |
||
| 107 | 'data' => "property = test,\\\r\ntest2,\\\r\ntest3\r\n", |
||
| 108 | 'expected' => [ |
||
| 109 | 'property' => 'test,test2,test3', |
||
| 110 | ], |
||
| 111 | ], |
||
| 112 | [ |
||
| 113 | 'data' => '# property = test', |
||
| 114 | 'expected' => [], |
||
| 115 | ], |
||
| 116 | [ |
||
| 117 | 'data' => ' # property = test', |
||
| 118 | 'expected' => [], |
||
| 119 | ], |
||
| 120 | [ |
||
| 121 | 'data' => '; property = test', |
||
| 122 | 'expected' => [], |
||
| 123 | ], |
||
| 124 | [ |
||
| 125 | 'data' => 'property=test', |
||
| 126 | 'expected' => [ |
||
| 127 | 'property' => 'test', |
||
| 128 | ], |
||
| 129 | ], |
||
| 130 | [ |
||
| 131 | 'data' => 'property = true', |
||
| 132 | 'expected' => [ |
||
| 133 | 'property' => 'true', |
||
| 134 | ], |
||
| 135 | ], |
||
| 136 | [ |
||
| 137 | 'data' => 'property = false', |
||
| 138 | 'expected' => [ |
||
| 139 | 'property' => 'false', |
||
| 140 | ], |
||
| 141 | ], |
||
| 142 | [ |
||
| 143 | 'data' => "[app]\napp.uno=foo\napp.dos=bar\napp.tres=baz\n", |
||
| 144 | 'expected' => [ |
||
| 145 | 'app.uno' => 'foo', |
||
| 146 | 'app.dos' => 'bar', |
||
| 147 | 'app.tres' => 'baz', |
||
| 148 | ], |
||
| 153 |