| 1: | <?php |
| 2: | declare(strict_types=1); |
| 3: | |
| 4: | namespace om\ICal\Value; |
| 5: | |
| 6: | use om\ICal\Parameters; |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | final readonly class Image { |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | public function __construct( |
| 18: | public ?string $uri, |
| 19: | public ?string $data, |
| 20: | public Parameters $parameters, |
| 21: | ) { |
| 22: | } |
| 23: | |
| 24: | public function isBinary(): bool { |
| 25: | return $this->data !== null; |
| 26: | } |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public function display(): array { |
| 34: | $display = array_map(strtoupper(...), $this->parameters->values('DISPLAY')); |
| 35: | return $display === [] ? ['BADGE'] : $display; |
| 36: | } |
| 37: | |
| 38: | |
| 39: | public function mediaType(): ?string { |
| 40: | return $this->parameters->get('FMTTYPE'); |
| 41: | } |
| 42: | |
| 43: | |
| 44: | public function altRep(): ?string { |
| 45: | return $this->parameters->get('ALTREP'); |
| 46: | } |
| 47: | } |
| 48: | |