| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| 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 |
||
| 41 | public function getPayloads() |
||
| 42 | { |
||
| 43 | return [ |
||
| 44 | 'Simple AND Criterion' => [ |
||
| 45 | [ |
||
| 46 | 'AND' => [ |
||
| 47 | 'ContentTypeIdentifierCriterion' => [ |
||
| 48 | 0 => 'author', |
||
| 49 | 1 => 'book', |
||
| 50 | ], |
||
| 51 | 'Field' => [ |
||
| 52 | 'name' => 'title', |
||
| 53 | 'operator' => 'EQ', |
||
| 54 | 'value' => 'Contributing to projects', |
||
| 55 | ], |
||
| 56 | ], |
||
| 57 | ], |
||
| 58 | 3, |
||
| 59 | ], |
||
| 60 | 'Combined AND with nested OR Criterion' => [ |
||
| 61 | [ |
||
| 62 | 'AND' => [ |
||
| 63 | [ |
||
| 64 | 'OR' => [ |
||
| 65 | 'ContentTypeIdentifierCriterion' => [ |
||
| 66 | 'article', |
||
| 67 | 'folder', |
||
| 68 | ], |
||
| 69 | ], |
||
| 70 | ], |
||
| 71 | [ |
||
| 72 | 'OR' => [ |
||
| 73 | 'ContentTypeIdentifierCriterion' => [ |
||
| 74 | 'forum', |
||
| 75 | 'board', |
||
| 76 | ], |
||
| 77 | ], |
||
| 78 | ], |
||
| 79 | ], |
||
| 80 | ], |
||
| 81 | 2, |
||
| 82 | ], |
||
| 83 | 'Combined AND with nested OR Criterion using old format' => [ |
||
| 84 | [ |
||
| 85 | 'AND' => [ |
||
| 86 | [ |
||
| 87 | 'OR' => [ |
||
| 88 | [ |
||
| 89 | 'ContentTypeIdentifierCriterion' => [ |
||
| 90 | 'article', |
||
| 91 | 'folder', |
||
| 92 | ], |
||
| 93 | ], |
||
| 94 | ], |
||
| 95 | ], |
||
| 96 | [ |
||
| 97 | 'OR' => [ |
||
| 98 | 'ContentTypeIdentifierCriterion' => [ |
||
| 99 | 'forum', |
||
| 100 | 'board', |
||
| 101 | ], |
||
| 102 | ], |
||
| 103 | ], |
||
| 104 | ], |
||
| 105 | ], |
||
| 106 | 2, |
||
| 107 | ], |
||
| 108 | ]; |
||
| 109 | } |
||
| 110 | |||
| 130 |