Conditions | 1 |
Paths | 1 |
Total Lines | 58 |
Code Lines | 35 |
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 |
||
40 | public function providerDMax(): array |
||
41 | { |
||
42 | return [ |
||
43 | [ |
||
44 | 96, |
||
45 | $this->database1(), |
||
46 | 'Profit', |
||
47 | [ |
||
48 | ['Tree', 'Height', 'Height'], |
||
49 | ['=Apple', '>10', '<16'], |
||
50 | ['=Pear', null, null], |
||
51 | ], |
||
52 | ], |
||
53 | [ |
||
54 | 340000, |
||
55 | $this->database2(), |
||
56 | 'Sales', |
||
57 | [ |
||
58 | ['Quarter', 'Area'], |
||
59 | [2, 'North'], |
||
60 | ], |
||
61 | ], |
||
62 | [ |
||
63 | 460000, |
||
64 | $this->database2(), |
||
65 | 'Sales', |
||
66 | [ |
||
67 | ['Sales Rep.', 'Quarter'], |
||
68 | ['Carol', '>1'], |
||
69 | ], |
||
70 | ], |
||
71 | 'omitted field name' => [ |
||
72 | ExcelError::VALUE(), |
||
73 | $this->database1(), |
||
74 | null, |
||
75 | $this->database1(), |
||
76 | ], |
||
77 | 'field column number okay' => [ |
||
78 | 18, |
||
79 | $this->database1(), |
||
80 | 2, |
||
81 | $this->database1(), |
||
82 | ], |
||
83 | /* Excel seems to return #NAME? when column number |
||
84 | is too high or too low. This makes so little sense |
||
85 | to me that I'm not going to bother coding that up, |
||
86 | content to return #VALUE! as an invalid name would */ |
||
87 | 'field column number too high' => [ |
||
88 | ExcelError::VALUE(), |
||
89 | $this->database1(), |
||
90 | 99, |
||
91 | $this->database1(), |
||
92 | ], |
||
93 | 'field column number too low' => [ |
||
94 | ExcelError::VALUE(), |
||
95 | $this->database1(), |
||
96 | 0, |
||
97 | $this->database1(), |
||
98 | ], |
||
102 |