| Conditions | 1 |
| Paths | 1 |
| Total Lines | 119 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 22 | public function providerForTestMatchAll() |
||
| 23 | { |
||
| 24 | $query = new Query(['filter' => new Criterion\MatchAll()]); |
||
| 25 | $result = $this->getRepository()->getSearchService()->findContent($query); |
||
| 26 | // Sanity check |
||
| 27 | $this->assertGreaterThan(0, $result->totalCount); |
||
| 28 | $totalCount = $result->totalCount; |
||
| 29 | $contentId = 12; |
||
| 30 | |||
| 31 | return [ |
||
| 32 | [ |
||
| 33 | new Criterion\LogicalOr( |
||
| 34 | [ |
||
| 35 | new Criterion\ContentId($contentId), |
||
| 36 | new Criterion\LogicalNot( |
||
| 37 | new Criterion\ContentId($contentId) |
||
| 38 | ), |
||
| 39 | ] |
||
| 40 | ), |
||
| 41 | $totalCount, |
||
| 42 | ], |
||
| 43 | [ |
||
| 44 | new Criterion\LogicalOr( |
||
| 45 | [ |
||
| 46 | |||
| 47 | new Criterion\ContentId($contentId), |
||
| 48 | new Criterion\LogicalNot( |
||
| 49 | new Criterion\LogicalNot( |
||
| 50 | new Criterion\ContentId($contentId) |
||
| 51 | ) |
||
| 52 | ), |
||
| 53 | ] |
||
| 54 | ), |
||
| 55 | 1, |
||
| 56 | ], |
||
| 57 | [ |
||
| 58 | new Criterion\LogicalOr( |
||
| 59 | [ |
||
| 60 | new Criterion\LogicalNot( |
||
| 61 | new Criterion\ContentId($contentId) |
||
| 62 | ), |
||
| 63 | new Criterion\LogicalNot( |
||
| 64 | new Criterion\LogicalNot( |
||
| 65 | new Criterion\ContentId($contentId) |
||
| 66 | ) |
||
| 67 | ), |
||
| 68 | ] |
||
| 69 | ), |
||
| 70 | $totalCount, |
||
| 71 | ], |
||
| 72 | [ |
||
| 73 | new Criterion\LogicalOr( |
||
| 74 | [ |
||
| 75 | new Criterion\LogicalNot( |
||
| 76 | new Criterion\ContentId($contentId) |
||
| 77 | ), |
||
| 78 | new Criterion\LogicalNot( |
||
| 79 | new Criterion\ContentId($contentId) |
||
| 80 | ), |
||
| 81 | ] |
||
| 82 | ), |
||
| 83 | $totalCount - 1, |
||
| 84 | ], |
||
| 85 | |||
| 86 | [ |
||
| 87 | new Criterion\LogicalAnd( |
||
| 88 | [ |
||
| 89 | new Criterion\ContentId($contentId), |
||
| 90 | new Criterion\LogicalNot( |
||
| 91 | new Criterion\ContentId($contentId) |
||
| 92 | ), |
||
| 93 | ] |
||
| 94 | ), |
||
| 95 | 0, |
||
| 96 | ], |
||
| 97 | [ |
||
| 98 | new Criterion\LogicalAnd( |
||
| 99 | [ |
||
| 100 | |||
| 101 | new Criterion\ContentId($contentId), |
||
| 102 | new Criterion\LogicalNot( |
||
| 103 | new Criterion\LogicalNot( |
||
| 104 | new Criterion\ContentId($contentId) |
||
| 105 | ) |
||
| 106 | ), |
||
| 107 | ] |
||
| 108 | ), |
||
| 109 | 1, |
||
| 110 | ], |
||
| 111 | [ |
||
| 112 | new Criterion\LogicalAnd( |
||
| 113 | [ |
||
| 114 | new Criterion\LogicalNot( |
||
| 115 | new Criterion\ContentId($contentId) |
||
| 116 | ), |
||
| 117 | new Criterion\LogicalNot( |
||
| 118 | new Criterion\LogicalNot( |
||
| 119 | new Criterion\ContentId($contentId) |
||
| 120 | ) |
||
| 121 | ), |
||
| 122 | ] |
||
| 123 | ), |
||
| 124 | 0, |
||
| 125 | ], |
||
| 126 | [ |
||
| 127 | new Criterion\LogicalAnd( |
||
| 128 | [ |
||
| 129 | new Criterion\LogicalNot( |
||
| 130 | new Criterion\ContentId($contentId) |
||
| 131 | ), |
||
| 132 | new Criterion\LogicalNot( |
||
| 133 | new Criterion\ContentId($contentId) |
||
| 134 | ), |
||
| 135 | ] |
||
| 136 | ), |
||
| 137 | $totalCount - 1, |
||
| 138 | ], |
||
| 139 | ]; |
||
| 140 | } |
||
| 141 | |||
| 218 |