| 1: | <?php |
| 2: | declare(strict_types=1); |
| 3: | |
| 4: | namespace om\ICal\Value; |
| 5: | |
| 6: | use DateInterval; |
| 7: | use om\ICal\Parameters; |
| 8: | use Stringable; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | final readonly class Relation implements Stringable { |
| 14: | |
| 15: | |
| 16: | |
| 17: | public function __construct( |
| 18: | public string $value, |
| 19: | public Parameters $parameters, |
| 20: | ) { |
| 21: | } |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | public function valueType(): string { |
| 27: | return strtoupper($this->parameters->get('VALUE') ?? 'UID'); |
| 28: | } |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function type(): string { |
| 35: | return strtoupper($this->parameters->get('RELTYPE') ?? 'PARENT'); |
| 36: | } |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | public function gap(): ?DateInterval { |
| 42: | $gap = $this->parameters->get('GAP'); |
| 43: | return $gap === null ? null : Duration::parse($gap); |
| 44: | } |
| 45: | |
| 46: | public function __toString(): string { |
| 47: | return $this->value; |
| 48: | } |
| 49: | } |
| 50: | |