Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
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 |
||
55 | public function timestampProvider() { |
||
56 | return array( |
||
57 | // Make sure it's identical to the PHP/Unix time stamps in current years |
||
58 | array( '+2004-02-29T00:00:00Z', strtotime( '2004-02-29T00:00:00+00:00' ) ), |
||
59 | array( '+2038-00-00T00:00:00Z', strtotime( '2038-01-01T00:00:00+00:00' ) ), |
||
60 | |||
61 | // Time zones |
||
62 | array( '+2000-01-01T12:59:59', strtotime( '2000-01-01T12:59:59-02:00' ), -120 ), |
||
63 | array( '+2000-01-01T12:59:59', strtotime( '2000-01-01T12:59:59+04:45' ), 285 ), |
||
64 | |||
65 | array( '+0401-00-00T00:00:00Z', -49512816000 ), |
||
66 | array( '+1902-00-00T00:00:00Z', -2145916800 ), |
||
67 | array( '+1939-00-00T00:00:00Z', -978307200 ), |
||
68 | array( '+1969-12-31T23:59:00Z', -60 ), |
||
69 | array( '+1969-12-31T23:59:59Z', -1 ), |
||
70 | array( '+1970-01-01T00:00:00Z', 0 ), |
||
71 | array( '+1970-01-01T00:00:01Z', 1 ), |
||
72 | array( '+1970-01-01T00:01:00Z', 60 ), |
||
73 | array( '+1972-02-29T00:00:00Z', 68169600 ), |
||
74 | array( '+1996-02-29T00:00:00Z', 825552000 ), |
||
75 | array( '+1999-12-31T23:59:59Z', 946684799 ), |
||
76 | array( '+2000-01-01T00:00:00Z', 946684800 ), |
||
77 | array( '+2000-02-01T00:00:00Z', 949363200 ), |
||
78 | array( '+2000-02-29T00:00:00Z', 951782400 ), |
||
79 | array( '+2001-00-00T00:00:00Z', 978307200 ), |
||
80 | array( '+2001-01-01T00:00:00Z', 978307200 ), |
||
81 | array( '+2014-04-30T12:35:55Z', 1398861355 ), |
||
82 | array( '+2401-00-00T00:00:00Z', 13601088000 ), |
||
83 | |||
84 | // Make sure there is only 1 second between these two |
||
85 | array( '-0001-12-31T23:59:59Z', -62135596801 ), |
||
86 | array( '+0001-00-00T00:00:00Z', -62135596800 ), |
||
87 | |||
88 | // No special calculation for leap seconds, just make sure they pass |
||
89 | array( '+1970-10-11T12:13:61Z', 24495241 ), |
||
90 | array( '+1970-10-11T12:14:01Z', 24495241 ), |
||
91 | |||
92 | // Year 0 does not exist, but we do not complain, assume -1 |
||
93 | array( '-0000-12-31T23:59:59Z', -62135596801 ), |
||
94 | array( '+0000-00-00T00:00:00Z', floor( ( -1 - 1969 ) * 365.2425 ) * 86400 ), |
||
95 | |||
96 | // Since there is no year 0, negative leap years are -1, -5 and so on |
||
97 | array( '-8001-00-00T00:00:00Z', floor( ( -8001 - 1969 ) * 365.2425 ) * 86400 ), |
||
98 | array( '-0005-00-00T00:00:00Z', floor( ( -5 - 1969 ) * 365.2425 ) * 86400 ), |
||
99 | array( '+0004-00-00T00:00:00Z', floor( ( 4 - 1970 ) * 365.2425 ) * 86400 ), |
||
100 | array( '+8000-00-00T00:00:00Z', floor( ( 8000 - 1970 ) * 365.2425 ) * 86400 ), |
||
101 | |||
102 | // PHP_INT_MIN is -2147483648 |
||
103 | array( '-2147484001-00-00T00:00:00Z', floor( ( -2147484001 - 1969 ) * 365.2425 ) * 86400 ), |
||
104 | // PHP_INT_MAX is +2147483647 |
||
105 | array( '+2147484000-00-00T00:00:00Z', floor( ( 2147484000 - 1970 ) * 365.2425 ) * 86400 ), |
||
106 | ); |
||
107 | } |
||
108 | |||
213 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.