Conditions | 1 |
Paths | 1 |
Total Lines | 111 |
Code Lines | 86 |
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 |
||
24 | public function provideTestInput(): Generator |
||
25 | { |
||
26 | yield 'for name foo and bar' => [ |
||
27 | 'arguments' => [ |
||
28 | 'name' => ['foo', 'bar'], |
||
29 | 'sellIn' => [3], |
||
30 | 'quantity' => [15], |
||
31 | ], |
||
32 | 'expected' => [ |
||
33 | ['bar', 3, 15], |
||
34 | ['foo', 3, 15], |
||
35 | ], |
||
36 | ]; |
||
37 | |||
38 | yield 'for sellIn 1 and 3' => [ |
||
39 | 'arguments' => [ |
||
40 | ['foo', 'bar'], |
||
41 | [1, 3], |
||
42 | [15], |
||
43 | ], |
||
44 | 'expected' => [ |
||
45 | ['bar', 3, 15], |
||
46 | ['bar', 1, 15], |
||
47 | ['foo', 3, 15], |
||
48 | ['foo', 1, 15], |
||
49 | ], |
||
50 | ]; |
||
51 | |||
52 | yield 'for two lists' => [ |
||
53 | 'arguments' => [ |
||
54 | ['foo', 'bar'], |
||
55 | [1, 3], |
||
56 | ], |
||
57 | 'expected' => [ |
||
58 | ['bar', 3], |
||
59 | ['bar', 1], |
||
60 | ['foo', 3], |
||
61 | ['foo', 1], |
||
62 | ], |
||
63 | ]; |
||
64 | |||
65 | yield 'for four flat lists' => [ |
||
66 | 'arguments' => [ |
||
67 | ['foo', 'bar'], |
||
68 | [1, 3], |
||
69 | [0, 1], |
||
70 | [4, 5], |
||
71 | ], |
||
72 | 'expected' => [ |
||
73 | ['bar', 3, 1, 5], |
||
74 | ['bar', 3, 1, 4], |
||
75 | ['bar', 3, 0, 5], |
||
76 | ['bar', 3, 0, 4], |
||
77 | ['bar', 1, 1, 5], |
||
78 | ['bar', 1, 1, 4], |
||
79 | ['bar', 1, 0, 5], |
||
80 | ['bar', 1, 0, 4], |
||
81 | ['foo', 3, 1, 5], |
||
82 | ['foo', 3, 1, 4], |
||
83 | ['foo', 3, 0, 5], |
||
84 | ['foo', 3, 0, 4], |
||
85 | ['foo', 1, 1, 5], |
||
86 | ['foo', 1, 1, 4], |
||
87 | ['foo', 1, 0, 5], |
||
88 | ['foo', 1, 0, 4], |
||
89 | ], |
||
90 | ]; |
||
91 | |||
92 | yield 'lots of values' => [ |
||
93 | 'arguments' => [ |
||
94 | ['foo', 'bar', 'awesome'], |
||
95 | [1, 3, 5], |
||
96 | [15, 50, 100, 101], |
||
97 | ], |
||
98 | 'expected' => [ |
||
99 | ['awesome', 5, 101], |
||
100 | ['awesome', 5, 100], |
||
101 | ['awesome', 5, 50], |
||
102 | ['awesome', 5, 15], |
||
103 | ['awesome', 3, 101], |
||
104 | ['awesome', 3, 100], |
||
105 | ['awesome', 3, 50], |
||
106 | ['awesome', 3, 15], |
||
107 | ['awesome', 1, 101], |
||
108 | ['awesome', 1, 100], |
||
109 | ['awesome', 1, 50], |
||
110 | ['awesome', 1, 15], |
||
111 | ['bar', 5, 101], |
||
112 | ['bar', 5, 100], |
||
113 | ['bar', 5, 50], |
||
114 | ['bar', 5, 15], |
||
115 | ['bar', 3, 101], |
||
116 | ['bar', 3, 100], |
||
117 | ['bar', 3, 50], |
||
118 | ['bar', 3, 15], |
||
119 | ['bar', 1, 101], |
||
120 | ['bar', 1, 100], |
||
121 | ['bar', 1, 50], |
||
122 | ['bar', 1, 15], |
||
123 | ['foo', 5, 101], |
||
124 | ['foo', 5, 100], |
||
125 | ['foo', 5, 50], |
||
126 | ['foo', 5, 15], |
||
127 | ['foo', 3, 101], |
||
128 | ['foo', 3, 100], |
||
129 | ['foo', 3, 50], |
||
130 | ['foo', 3, 15], |
||
131 | ['foo', 1, 101], |
||
132 | ['foo', 1, 100], |
||
133 | ['foo', 1, 50], |
||
134 | ['foo', 1, 15], |
||
135 | ], |
||
139 |