| Conditions | 4 |
| Paths | 8 |
| Total Lines | 27 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | $date = isset($torrent[Torrent\Get::DONE_DATE]) && $torrent[Torrent\Get::DONE_DATE] ? |
||
| 17 | $torrent[Torrent\Get::DONE_DATE] : |
||
| 18 | (isset($torrent[Torrent\Get::ADDED_DATE]) ? $torrent[Torrent\Get::ADDED_DATE] : 0); |
||
| 19 | return $date ? time() - $date : 0; |
||
| 20 | } |
||
| 21 | |||
| 22 | public static function getTorrentAgeInDays($torrent) |
||
| 23 | { |
||
| 24 | return round(self::getTorrentAge($torrent) / 86400); |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function getSizeInGb($sizeInBytes, $round = 2) |
||
| 28 | { |
||
| 29 | // 1024 not equals transmission value |
||
| 30 | return round($sizeInBytes / 1000 / 1000 / 1000, $round); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |