Conditions | 1 |
Paths | 1 |
Total Lines | 70 |
Code Lines | 38 |
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 |
||
76 | public function resolveScenarioDataProvider(): array |
||
77 | { |
||
78 | return [ |
||
79 | 'no plugins provided' => [ |
||
80 | [ |
||
81 | 'plugins' => [], |
||
82 | ], |
||
83 | 'default', |
||
84 | ], |
||
85 | 'single applicable query' => [ |
||
86 | [ |
||
87 | 'plugins' => [ |
||
88 | 'applicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => true], |
||
89 | ], |
||
90 | ], |
||
91 | 'applicable', |
||
92 | ], |
||
93 | 'single non-applicable query' => [ |
||
94 | [ |
||
95 | 'plugins' => [ |
||
96 | 'nonApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => false], |
||
97 | ], |
||
98 | ], |
||
99 | 'nonApplicable', |
||
100 | ], |
||
101 | 'first applicable query when multiple exist' => [ |
||
102 | [ |
||
103 | 'plugins' => [ |
||
104 | 'firstApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => true], |
||
105 | 'secondApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => true], |
||
106 | ], |
||
107 | ], |
||
108 | 'firstApplicable', |
||
109 | ], |
||
110 | 'applicable query found among non-applicable' => [ |
||
111 | [ |
||
112 | 'plugins' => [ |
||
113 | 'nonApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => false], |
||
114 | 'applicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => true], |
||
115 | ], |
||
116 | ], |
||
117 | 'applicable', |
||
118 | ], |
||
119 | 'last plugin when no applicable found' => [ |
||
120 | [ |
||
121 | 'plugins' => [ |
||
122 | 'firstNonApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => false], |
||
123 | 'lastNonApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => false], |
||
124 | ], |
||
125 | ], |
||
126 | 'lastNonApplicable', |
||
127 | ], |
||
128 | 'last plugin when no applicability checker' => [ |
||
129 | [ |
||
130 | 'plugins' => [ |
||
131 | 'first' => ['hasApplicabilityChecker' => false, 'isApplicable' => false], |
||
132 | 'last' => ['hasApplicabilityChecker' => false, 'isApplicable' => false], |
||
133 | ], |
||
134 | ], |
||
135 | 'last', |
||
136 | ], |
||
137 | 'mixed plugin types with applicable found' => [ |
||
138 | [ |
||
139 | 'plugins' => [ |
||
140 | 'regular' => ['hasApplicabilityChecker' => false, 'isApplicable' => false], |
||
141 | 'nonApplicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => false], |
||
142 | 'applicable' => ['hasApplicabilityChecker' => true, 'isApplicable' => true], |
||
143 | ], |
||
144 | ], |
||
145 | 'applicable', |
||
146 | ], |
||
178 |