Conditions | 5 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | public static function time_elapsed($timestamp) { |
||
25 | $seconds = max((time() - strtotime($timestamp)),0); |
||
26 | |||
27 | if($seconds < 60) { |
||
28 | $number = $seconds; |
||
29 | $text = "second"; |
||
30 | } elseif($seconds < (60 * 60)) { |
||
31 | $number = $seconds / 60; |
||
32 | $text = "minute"; |
||
33 | } elseif($seconds < (60 * 60 * 24)) { |
||
34 | $number = $seconds / (60 * 60); |
||
35 | $text = "hour"; |
||
36 | } else { |
||
37 | $number = $seconds / (60 * 60 * 24); |
||
38 | $text = "day"; |
||
39 | } |
||
40 | |||
41 | $number = floor($number); |
||
42 | |||
43 | if($number > 1) { |
||
44 | $text.="s"; |
||
45 | } |
||
46 | |||
47 | return "$number $text"; |
||
48 | } |
||
49 | |||
50 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.