| Conditions | 1 |
| Paths | 1 |
| Total Lines | 92 |
| Code Lines | 64 |
| 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 |
||
| 113 | public function renderingSuccessProvider(): array |
||
| 114 | { |
||
| 115 | return [ |
||
| 116 | 'content-only-1' => [ |
||
| 117 | 'abc', |
||
| 118 | [], |
||
| 119 | [], |
||
| 120 | 'abc', |
||
| 121 | ], |
||
| 122 | 'content-with-vars-only-1' => [ |
||
| 123 | '0 {{var/variable-one-1}} 1', |
||
| 124 | ['variable-one-1' => 'abc'], |
||
| 125 | [], |
||
| 126 | '0 abc 1', |
||
| 127 | ], |
||
| 128 | 'content-with-vars-only-2' => [ |
||
| 129 | '0 {{var/variable-one-1}} 1{{var/variable-one-2}}2', |
||
| 130 | ['variable-one-1' => 'abc'], |
||
| 131 | [], |
||
| 132 | '0 abc 12', |
||
| 133 | ], |
||
| 134 | 'content-with-vars-only-3' => [ |
||
| 135 | '0 {{var/variable-one-1}} 1{{var/variable-one-2}}2', |
||
| 136 | ['variable-one-1' => 'abc', 'variable-one-2' => 'bcd'], |
||
| 137 | [], |
||
| 138 | '0 abc 1bcd2', |
||
| 139 | ], |
||
| 140 | 'content-with-repeated-vars' => [ |
||
| 141 | '0 {{var/variable-one-1}} {{var/variable-one-1}} 1', |
||
| 142 | ['variable-one-1' => 'abc'], |
||
| 143 | [], |
||
| 144 | '0 abc abc 1', |
||
| 145 | ], |
||
| 146 | 'content-with-modified-repeated-vars' => [ |
||
| 147 | '0 {{var/variable-one-1}} {{ var/variable-one-1 }} 1', |
||
| 148 | ['variable-one-1' => 'abc'], |
||
| 149 | [], |
||
| 150 | '0 abc abc 1', |
||
| 151 | ], |
||
| 152 | 'content-with-blocks-only-1' => [ |
||
| 153 | '0 {{block/one-1}} 1', |
||
| 154 | [], |
||
| 155 | ['block' => ['one-1' => 'abc']], |
||
| 156 | '0 abc 1', |
||
| 157 | ], |
||
| 158 | 'content-with-blocks-only-2' => [ |
||
| 159 | '0 {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 160 | [], |
||
| 161 | ['block' => ['one-1' => 'abc']], |
||
| 162 | '0 abc 12', |
||
| 163 | ], |
||
| 164 | 'content-with-blocks-only-3' => [ |
||
| 165 | '0 {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 166 | [], |
||
| 167 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 168 | '0 abc 1bcd2', |
||
| 169 | ], |
||
| 170 | 'content-with-repeated-blocks' => [ |
||
| 171 | '0 {{block/one-1}} {{block/one-1}} 1{{block/two-2-two}}2', |
||
| 172 | [], |
||
| 173 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 174 | '0 abc abc 1bcd2', |
||
| 175 | ], |
||
| 176 | 'content-with-modified-repeated-blocks' => [ |
||
| 177 | '0 {{block/one-1}} {{ block/one-1 }} 1{{block/two-2-two}}2', |
||
| 178 | [], |
||
| 179 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 180 | '0 abc abc 1bcd2', |
||
| 181 | ], |
||
| 182 | 'complex-1' => [ |
||
| 183 | '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 |
||
| 184 | ['3-threeThree' => 'cde'], |
||
| 185 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd'], 'gallery' => ['event-1' => 'fgh']], |
||
| 186 | '0 abc abc cde 1bcd2fgh bcd', |
||
| 187 | ], |
||
| 188 | 'complex-without-subtemplate-value' => [ |
||
| 189 | '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 |
||
| 190 | ['3-threeThree' => 'cde'], |
||
| 191 | ['block' => ['one-1' => 'abc'], 'gallery' => ['event-1' => 'fgh']], |
||
| 192 | '0 abc abc cde 12fgh ', |
||
| 193 | ], |
||
| 194 | 'complex-without-subtemplate-type' => [ |
||
| 195 | '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 |
||
| 196 | ['3-threeThree' => 'cde'], |
||
| 197 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 198 | '0 abc abc cde 1bcd2 bcd', |
||
| 199 | ], |
||
| 200 | 'brutal' => [ |
||
| 201 | "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 |
||
| 202 | ['3-threeThree' => 'cde'], |
||
| 203 | ['block' => ['one-1' => 'abc', 'two-2-two' => 'bcd']], |
||
| 204 | "0 {{nope/nay}} abc abc cde 1bcd2\nbcd", |
||
| 205 | ], |
||
| 228 |