Conditions | 1 |
Paths | 1 |
Total Lines | 94 |
Code Lines | 77 |
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 |
||
92 | protected function banknotes(): array |
||
93 | { |
||
94 | return [ |
||
95 | [ |
||
96 | 'key' => 'banknote-1000', |
||
97 | 'name' => 'Seribu', |
||
98 | 'value' => 1000, |
||
99 | 'type' => DenominationType::banknote(), |
||
100 | 'quantity_per_bundle' => 100, |
||
101 | 'minimum_order_bundle' => 1, |
||
102 | 'maximum_order_bundle' => 2, |
||
103 | 'minimum_order_quantity' => 1, |
||
104 | 'image' => 'banknote-1000.jpg', |
||
105 | ], |
||
106 | [ |
||
107 | 'key' => 'banknote-2000', |
||
108 | 'name' => 'Dua ribu', |
||
109 | 'value' => 2000, |
||
110 | 'type' => DenominationType::banknote(), |
||
111 | 'quantity_per_bundle' => 100, |
||
112 | 'minimum_order_bundle' => 1, |
||
113 | 'maximum_order_bundle' => 2, |
||
114 | 'minimum_order_quantity' => 1, |
||
115 | 'image' => 'banknote-2000.jpg', |
||
116 | 'is_visible' => true, |
||
117 | ], |
||
118 | [ |
||
119 | 'key' => 'banknote-5000', |
||
120 | 'name' => 'Lima ribu', |
||
121 | 'value' => 5000, |
||
122 | 'type' => DenominationType::banknote(), |
||
123 | 'quantity_per_bundle' => 100, |
||
124 | 'minimum_order_bundle' => 1, |
||
125 | 'maximum_order_bundle' => 2, |
||
126 | 'minimum_order_quantity' => 1, |
||
127 | 'image' => 'banknote-5000.jpg', |
||
128 | 'is_visible' => true, |
||
129 | ], |
||
130 | [ |
||
131 | 'key' => 'banknote-10000', |
||
132 | 'name' => 'Sepuluh ribu', |
||
133 | 'value' => 10000, |
||
134 | 'type' => DenominationType::banknote(), |
||
135 | 'quantity_per_bundle' => 100, |
||
136 | 'minimum_order_bundle' => 1, |
||
137 | 'maximum_order_bundle' => 1, |
||
138 | 'minimum_order_quantity' => 1, |
||
139 | 'image' => 'banknote-10000.jpg', |
||
140 | 'is_visible' => true, |
||
141 | ], |
||
142 | [ |
||
143 | 'key' => 'banknote-20000', |
||
144 | 'name' => 'Dua puluh ribu', |
||
145 | 'value' => 20000, |
||
146 | 'type' => DenominationType::banknote(), |
||
147 | 'quantity_per_bundle' => 100, |
||
148 | 'minimum_order_bundle' => 1, |
||
149 | 'maximum_order_bundle' => 1, |
||
150 | 'minimum_order_quantity' => 1, |
||
151 | 'image' => 'banknote-20000.jpg', |
||
152 | 'is_visible' => true, |
||
153 | ], |
||
154 | [ |
||
155 | 'key' => 'banknote-50000', |
||
156 | 'name' => 'Lima puluh ribu', |
||
157 | 'value' => 50000, |
||
158 | 'type' => DenominationType::banknote(), |
||
159 | 'quantity_per_bundle' => 100, |
||
160 | 'minimum_order_bundle' => 1, |
||
161 | 'maximum_order_bundle' => 1, |
||
162 | 'minimum_order_quantity' => 1, |
||
163 | 'image' => 'banknote-50000.jpg', |
||
164 | ], |
||
165 | [ |
||
166 | 'key' => 'banknote-75000', |
||
167 | 'name' => 'Tujuh puluh lima ribu', |
||
168 | 'value' => 75000, |
||
169 | 'type' => DenominationType::banknote(), |
||
170 | 'quantity_per_bundle' => 100, |
||
171 | 'minimum_order_bundle' => 1, |
||
172 | 'maximum_order_bundle' => 1, |
||
173 | 'minimum_order_quantity' => 1, |
||
174 | 'image' => 'banknote-75000.jpg', |
||
175 | ], |
||
176 | [ |
||
177 | 'key' => 'banknote-100000', |
||
178 | 'name' => 'Seratus ribu', |
||
179 | 'value' => 100000, |
||
180 | 'type' => DenominationType::banknote(), |
||
181 | 'quantity_per_bundle' => 100, |
||
182 | 'minimum_order_bundle' => 1, |
||
183 | 'maximum_order_bundle' => 1, |
||
184 | 'minimum_order_quantity' => 1, |
||
185 | 'image' => 'banknote-100000.jpg', |
||
186 | ], |
||
190 |