1 | <?php |
||
2 | class Time |
||
3 | { |
||
4 | |||
5 | /** |
||
6 | * Returns true if given date is today. |
||
7 | * |
||
8 | * @param string $date Unix timestamp |
||
9 | * @return boolean True if date is today |
||
10 | */ |
||
11 | public static function isToday($date) |
||
15 | |||
16 | /** |
||
17 | * Returns true if given date was yesterday |
||
18 | * |
||
19 | * @param string $date Unix timestamp |
||
20 | * @return boolean True if date was yesterday |
||
21 | */ |
||
22 | public static function wasYesterday($date) |
||
26 | |||
27 | /** |
||
28 | * Returns true if given date is in this year |
||
29 | * |
||
30 | * @param string $date Unix timestamp |
||
31 | * @return boolean True if date is in this year |
||
32 | */ |
||
33 | public static function isThisYear($date) |
||
37 | |||
38 | /** |
||
39 | * Returns true if given date is in this week |
||
40 | * |
||
41 | * @param string $date Unix timestamp |
||
42 | * @return boolean True if date is in this week |
||
43 | */ |
||
44 | public static function isThisWeek($date) |
||
48 | |||
49 | /** |
||
50 | * Returns true if given date is in this month |
||
51 | * |
||
52 | * @param string $date Unix timestamp |
||
53 | * @return boolean True if date is in this month |
||
54 | */ |
||
55 | public static function isThisMonth($date) |
||
59 | |||
60 | public static function secondsToDifference($seconds) |
||
78 | } |
||
79 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.