| Conditions | 1 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 36 |
| 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 |
||
| 24 | public function parsingSuccessProvider(): array |
||
| 25 | { |
||
| 26 | return [ |
||
| 27 | 'empty' => [ |
||
| 28 | '', |
||
| 29 | [], |
||
| 30 | ], |
||
| 31 | 'fail' => [ |
||
| 32 | '', |
||
| 33 | [], |
||
| 34 | ], |
||
| 35 | 'content-only-1' => [ |
||
| 36 | '{{block/content-one-1}}', |
||
| 37 | [ |
||
| 38 | 'block' => |
||
| 39 | [ |
||
| 40 | 'content-one-1' => [ |
||
| 41 | new ParsedTemplate('block', 'content-one-1', [], ['{{block/content-one-1}}']), // phpcs:ignore |
||
| 42 | ], |
||
| 43 | ] |
||
| 44 | ], |
||
| 45 | ], |
||
| 46 | 'content-only-2' => [ |
||
| 47 | '{{block/content-one-1}} {{ block/content-2-two }}', |
||
| 48 | [ |
||
| 49 | 'block' => [ |
||
| 50 | 'content-2-two' => [ |
||
| 51 | new ParsedTemplate('block', 'content-2-two', [], ['{{ block/content-2-two }}']), // phpcs:ignore |
||
| 52 | ], |
||
| 53 | 'content-one-1' => [ |
||
| 54 | new ParsedTemplate('block', 'content-one-1', [], ['{{block/content-one-1}}']), |
||
| 55 | ], |
||
| 56 | ], |
||
| 57 | ], |
||
| 58 | ], |
||
| 59 | 'layout-only-3' => [ |
||
| 60 | '{{block/layout-one-1}} {{ block/layout-2-two }} {{block/layout-one-1 }}', |
||
| 61 | [ |
||
| 62 | 'block' => [ |
||
| 63 | 'layout-2-two' => [ |
||
| 64 | new ParsedTemplate('block', 'layout-2-two', [], ['{{ block/layout-2-two }}']), // phpcs:ignore |
||
| 65 | ], |
||
| 66 | 'layout-one-1' => [ |
||
| 67 | new ParsedTemplate( |
||
| 68 | 'block', |
||
| 69 | 'layout-one-1', |
||
| 70 | [], |
||
| 71 | ['{{block/layout-one-1}}', '{{block/layout-one-1 }}'] |
||
| 72 | ), |
||
| 73 | ], |
||
| 74 | ], |
||
| 75 | ], |
||
| 76 | ], |
||
| 77 | 'layout-with-attribute' => [ |
||
| 78 | '{{block/layout-one-1 a="value is a" a-2="value is a-2"}}', |
||
| 79 | [ |
||
| 80 | 'block' => [ |
||
| 81 | 'layout-one-1' => [ |
||
| 82 | new ParsedTemplate( |
||
| 83 | 'block', |
||
| 84 | 'layout-one-1', |
||
| 85 | ['a' => 'value is a', 'a-2' => 'value is a-2'], |
||
| 86 | ['{{block/layout-one-1 a="value is a" a-2="value is a-2"}}'] |
||
| 87 | ), |
||
| 228 |