| Total Complexity | 9 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class GeneralRuntime implements RuntimeExtensionInterface |
||
| 13 | { |
||
| 14 | /** @var $markdownService */ |
||
|
|
|||
| 15 | private $markdownService; |
||
| 16 | |||
| 17 | public function __construct(MarkdownService $markdownService) |
||
| 18 | { |
||
| 19 | $this->markdownService = $markdownService; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function durationToHMS(?DateInterval $interval): string |
||
| 23 | { |
||
| 24 | if (!isset($interval)) |
||
| 25 | return ""; |
||
| 26 | |||
| 27 | return $interval->format('%H:%I:%S'); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function starRating(?int $rating): string |
||
| 31 | { |
||
| 32 | if (is_int($rating) && $rating >= 0) { |
||
| 33 | return str_repeat('★', $rating); |
||
| 34 | } |
||
| 35 | return "-"; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function formatMetricBytes(int $bytes, string $format = null): string |
||
| 39 | { |
||
| 40 | return Metric::bytes($bytes)->format($format); |
||
| 41 | } |
||
| 42 | public function formatBinaryBytes(int $bytes, string $format = null): string |
||
| 43 | { |
||
| 44 | return Binary::bytes($bytes)->format($format); |
||
| 45 | } |
||
| 46 | public function markdownToPlainText(?string $markdown): string |
||
| 49 | } |
||
| 50 | } |