| Total Complexity | 8 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | final class MediaObject |
||
| 22 | { |
||
| 23 | private string $id; |
||
| 24 | |||
| 25 | public string $contentUrl; |
||
| 26 | |||
| 27 | public int $fileSize; |
||
| 28 | |||
| 29 | public string $mimeType; |
||
| 30 | |||
| 31 | public ?int $width = null; |
||
| 32 | |||
| 33 | public ?int $height = null; |
||
| 34 | |||
| 35 | public ?string $imagineFilter = null; |
||
| 36 | |||
| 37 | // defined otherwise the IRI mapping in API Platform does not work with just the getter method |
||
| 38 | private ?string $formattedFileSize = null; |
||
| 39 | |||
| 40 | public function __construct() |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getId(): string |
||
| 46 | { |
||
| 47 | return $this->id; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getFormattedFileSize(): string |
||
| 51 | { |
||
| 52 | return $this->formattedFileSize ?? $this->fileSize < 0 ? '' : $this->convertSizeToString($this->fileSize); |
||
| 53 | } |
||
| 54 | |||
| 55 | private function convertSizeToString(int $bytes): string |
||
| 70 | } |
||
| 71 | } |
||
| 72 |