Conditions | 1 |
Paths | 1 |
Total Lines | 71 |
Code Lines | 46 |
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 |
||
96 | public function providerInvoiceInitial(): array |
||
97 | { |
||
98 | return [ |
||
99 | 'free booking should create nothing' => [ |
||
100 | '0', |
||
101 | '0', |
||
102 | [], |
||
103 | ], |
||
104 | 'only initial' => [ |
||
105 | '10', |
||
106 | '0', |
||
107 | [ |
||
108 | [ |
||
109 | 'Paiement ponctuel', |
||
110 | 'My bookable', |
||
111 | 'John Doe', |
||
112 | 'Bookable account', |
||
113 | '10', |
||
114 | ], |
||
115 | ], |
||
116 | ], |
||
117 | 'only periodic' => [ |
||
118 | '0', |
||
119 | '90', |
||
120 | [ |
||
121 | [ |
||
122 | 'Paiement annuel', |
||
123 | 'My bookable', |
||
124 | 'John Doe', |
||
125 | 'Bookable account', |
||
126 | '90', |
||
127 | ], |
||
128 | ], |
||
129 | ], |
||
130 | 'both initial and periodic should create two lines' => [ |
||
131 | '10', |
||
132 | '90', |
||
133 | [ |
||
134 | [ |
||
135 | 'Paiement ponctuel', |
||
136 | 'My bookable', |
||
137 | 'John Doe', |
||
138 | 'Bookable account', |
||
139 | '10', |
||
140 | ], |
||
141 | [ |
||
142 | 'Paiement annuel', |
||
143 | 'My bookable', |
||
144 | 'John Doe', |
||
145 | 'Bookable account', |
||
146 | '90', |
||
147 | ], |
||
148 | ], |
||
149 | ], |
||
150 | 'negative balance should swap accounts' => [ |
||
151 | '-10', |
||
152 | '-90', |
||
153 | [ |
||
154 | [ |
||
155 | 'Paiement ponctuel', |
||
156 | 'My bookable', |
||
157 | 'Bookable account', |
||
158 | 'John Doe', |
||
159 | '10', |
||
160 | ], |
||
161 | [ |
||
162 | 'Paiement annuel', |
||
163 | 'My bookable', |
||
164 | 'Bookable account', |
||
165 | 'John Doe', |
||
166 | '90', |
||
167 | ], |
||
189 |