Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
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 |
||
28 | public function data_for(): array |
||
29 | { |
||
30 | return [ |
||
31 | [ |
||
32 | [ |
||
33 | 'start_at' => '2020-01-01', |
||
34 | 'charge_count' => '', |
||
35 | 'billing_period' => BillingPeriod::DAILY, |
||
36 | 'billing_interval' => 1 |
||
37 | ], |
||
38 | '2020-01-02 08:00:00', |
||
39 | ], |
||
40 | [ |
||
41 | [ |
||
42 | 'start_at' => '2020-01-01', |
||
43 | 'charge_count' => 4, |
||
44 | 'billing_period' => BillingPeriod::DAILY, |
||
45 | 'billing_interval' => 1 |
||
46 | ], |
||
47 | '2020-01-05 08:00:00', |
||
48 | ], |
||
49 | [ |
||
50 | [ |
||
51 | 'start_at' => '2020-01-01', |
||
52 | 'billing_period' => BillingPeriod::MONTHLY, |
||
53 | 'billing_interval' => 1 |
||
54 | ], |
||
55 | '2020-02-01 08:00:00', |
||
56 | ], |
||
57 | [ |
||
58 | [ |
||
59 | 'start_at' => '2021-05-31 00:00:00', |
||
60 | 'charge_count' => '', |
||
61 | 'billing_period' => BillingPeriod::MONTHLY, |
||
62 | 'billing_interval' => 1 |
||
63 | ], |
||
64 | '2021-06-30 08:00:00', |
||
65 | ], |
||
66 | [ |
||
67 | [ |
||
68 | 'start_at' => '2021-05-30 00:00:00', |
||
69 | 'charge_count' => '', |
||
70 | 'billing_period' => BillingPeriod::MONTHLY, |
||
71 | 'billing_interval' => 1 |
||
72 | ], |
||
73 | '2021-06-30 08:00:00', |
||
74 | ], |
||
75 | [ |
||
76 | [ |
||
77 | 'start_at' => '2021-06-30 00:00:00', |
||
78 | 'charge_count' => '', |
||
79 | 'billing_period' => BillingPeriod::MONTHLY, |
||
80 | 'billing_interval' => 1 |
||
81 | ], |
||
82 | '2021-07-30 08:00:00', |
||
83 | ], |
||
84 | [ |
||
85 | [ |
||
86 | 'start_at' => '2021-05-31 00:00:00', |
||
87 | 'charge_count' => 2, |
||
88 | 'billing_period' => BillingPeriod::MONTHLY, |
||
89 | 'billing_interval' => 1 |
||
90 | ], |
||
91 | '2021-07-31 08:00:00', |
||
92 | ] |
||
96 |