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