Conditions | 11 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 12 |
Lines | 12 |
Ratio | 48 % |
Changes | 1 | ||
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 |
||
50 | private static function isIntervalArrayAllDay(array $data) |
||
51 | { |
||
52 | if ($data['start']['hours'] != 0 || $data['end']['hours'] != 24) { |
||
53 | return false; |
||
54 | } |
||
55 | |||
56 | View Code Duplication | if (isset($data['start']['minutes']) && $data['start']['minutes'] != 0) { |
|
57 | return false; |
||
58 | } |
||
59 | |||
60 | View Code Duplication | if (isset($data['end']['minutes']) && $data['end']['minutes'] != 0) { |
|
61 | return false; |
||
62 | } |
||
63 | |||
64 | |||
65 | View Code Duplication | if (isset($data['start']['seconds']) && $data['start']['seconds'] != 0) { |
|
66 | return false; |
||
67 | } |
||
68 | |||
69 | View Code Duplication | if (isset($data['end']['seconds']) && $data['end']['seconds'] != 0) { |
|
70 | return false; |
||
71 | } |
||
72 | |||
73 | return true; |
||
74 | } |
||
75 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: