| Conditions | 1 |
| Paths | 1 |
| Total Lines | 92 |
| Code Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 128 | public function renderingSuccessProvider(): array |
||
| 129 | { |
||
| 130 | return [ |
||
| 131 | 'content-only-1' => [ |
||
| 132 | 'abc', |
||
| 133 | [], |
||
| 134 | [], |
||
| 135 | 'abc', |
||
| 136 | ], |
||
| 137 | 'content-with-vars-only-1' => [ |
||
| 138 | '0 {{var/variable-one-1}} 1', |
||
| 139 | ['variable-one-1' => 'abc'], |
||
| 140 | [], |
||
| 141 | '0 abc 1', |
||
| 142 | ], |
||
| 143 | 'content-with-vars-only-2' => [ |
||
| 144 | '0 {{var/variable-one-1}} 1{{var/variable-one-2}}2', |
||
| 145 | ['variable-one-1' => 'abc'], |
||
| 146 | [], |
||
| 147 | '0 abc 12', |
||
| 148 | ], |
||
| 149 | 'content-with-vars-only-3' => [ |
||
| 150 | '0 {{var/variable-one-1}} 1{{var/variable-one-2}}2', |
||
| 151 | ['variable-one-1' => 'abc', 'variable-one-2' => 'bcd'], |
||
| 152 | [], |
||
| 153 | '0 abc 1bcd2', |
||
| 154 | ], |
||
| 155 | 'content-with-repeated-vars' => [ |
||
| 156 | '0 {{var/variable-one-1}} {{var/variable-one-1}} 1', |
||
| 157 | ['variable-one-1' => 'abc'], |
||
| 158 | [], |
||
| 159 | '0 abc abc 1', |
||
| 160 | ], |
||
| 161 | 'content-with-modified-repeated-vars' => [ |
||
| 162 | '0 {{var/variable-one-1}} {{ var/variable-one-1 }} 1', |
||
| 163 | ['variable-one-1' => 'abc'], |
||
| 164 | [], |
||
| 165 | '0 abc abc 1', |
||
| 166 | ], |
||
| 167 | 'content-with-blocks-only-1' => [ |
||
| 168 | '0 {{block/one-1}} 1', |
||
| 169 | [], |
||
| 170 | ['block' => ['one-1' => 'abc']], |
||
| 171 | '0 abc 1', |
||
| 172 | ], |
||
| 173 | 'content-with-blocks-only-2' => [ |
||
| 174 | '0 {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 175 | [], |
||
| 176 | ['block' => ['one-1' => 'abc']], |
||
| 177 | '0 abc 12', |
||
| 178 | ], |
||
| 179 | 'content-with-blocks-only-3' => [ |
||
| 180 | '0 {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 181 | [], |
||
| 182 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 183 | '0 abc 1bcd2', |
||
| 184 | ], |
||
| 185 | 'content-with-repeated-blocks' => [ |
||
| 186 | '0 {{block/one-1}} {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 187 | [], |
||
| 188 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 189 | '0 abc abc 1bcd2', |
||
| 190 | ], |
||
| 191 | 'content-with-modified-repeated-blocks' => [ |
||
| 192 | '0 {{block/one-1}} {{ block/one-1 }} 1{{block/two-2-two}}2', |
||
| 193 | [], |
||
| 194 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 195 | '0 abc abc 1bcd2', |
||
| 196 | ], |
||
| 197 | 'complex-1' => [ |
||
| 198 | '0 {{block/one-1}} {{ block/one-1 }} {{var/3-threeThree}} 1{{block/two-2-two}}2{{gallery/event-1}} {{ block/two-2-two }}', // phpcs:ignore |
||
| 199 | ['3-threeThree' => 'cde'], |
||
| 200 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd'], 'gallery' => ['event-1' => 'fgh']], |
||
| 201 | '0 abc abc cde 1bcd2fgh bcd', |
||
| 202 | ], |
||
| 203 | 'complex-without-subtemplate-value' => [ |
||
| 204 | '0 {{block/one-1}} {{ block/one-1 }} {{var/3-threeThree}} 1{{block/two-2-two}}2{{gallery/event-1}} {{ block/two-2-two }}', // phpcs:ignore |
||
| 205 | ['3-threeThree' => 'cde'], |
||
| 206 | ['block' => ['one-1' => 'abc'], 'gallery' => ['event-1' => 'fgh']], |
||
| 207 | '0 abc abc cde 12fgh ', |
||
| 208 | ], |
||
| 209 | 'complex-without-subtemplate-type' => [ |
||
| 210 | '0 {{block/one-1}} {{ block/one-1 }} {{var/3-threeThree}} 1{{block/two-2-two}}2{{gallery/event-1}} {{ block/two-2-two }}', // phpcs:ignore |
||
| 211 | ['3-threeThree' => 'cde'], |
||
| 212 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 213 | '0 abc abc cde 1bcd2 bcd', |
||
| 214 | ], |
||
| 215 | 'brutal' => [ |
||
| 216 | "0 {{nope/nay}} {{block/one-1}} {{ block/one-1 }} {{var/3-threeThree}} 1{{block/two-2-two foo=\"This foo!\" bar=\"That bar!\"}}2{{gallery/event-1}}\n{{ block/two-2-two }}", // phpcs:ignore |
||
| 217 | ['3-threeThree' => 'cde'], |
||
| 218 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 219 | "0 {{nope/nay}} abc abc cde 1bcd2\nbcd", |
||
| 220 | ], |
||
| 243 |