| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | final class FileInfo |
||
| 8 | { |
||
| 9 | private $mimeType; |
||
| 10 | private $fileSize; |
||
| 11 | |||
| 12 | public static function fromArray($data): self |
||
| 13 | { |
||
| 14 | return new self($data['mime_type'], $data['file_size']); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function __construct(string $mimeType, int $fileSize) |
||
| 18 | { |
||
| 19 | $this->mimeType = $mimeType; |
||
| 20 | $this->fileSize = $fileSize; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function mimeType(): string |
||
| 24 | { |
||
| 25 | return $this->mimeType; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function fileSize(): int |
||
| 29 | { |
||
| 30 | return $this->fileSize; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function image(): bool |
||
| 36 | } |
||
| 37 | |||
| 38 | public function sameAs(self $info): bool |
||
| 39 | { |
||
| 40 | return $this->mimeType === $info->mimeType && $this->fileSize === $info->fileSize; |
||
| 43 |