|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Astrotomic\OpenGraph\Types\Video; |
| 4 | + |
| 5 | +use Astrotomic\OpenGraph\Type; |
| 6 | +use DateTime; |
| 7 | + |
| 8 | +class Episode extends Type |
| 9 | +{ |
| 10 | + protected const PREFIX = 'video'; |
| 11 | + |
| 12 | + protected string $type = 'video.episode'; |
| 13 | + |
| 14 | + public function series(string $url) |
| 15 | + { |
| 16 | + $this->setProperty(self::PREFIX, 'series', $url); |
| 17 | + |
| 18 | + return $this; |
| 19 | + } |
| 20 | + |
| 21 | + public function actor(string $url, ?string $role = null) |
| 22 | + { |
| 23 | + $this->addProperty(self::PREFIX, 'actor', $url); |
| 24 | + $this->when($role, fn(Movie $movie) => $movie->addProperty(self::PREFIX, 'actor:role', $role)); |
| 25 | + |
| 26 | + return $this; |
| 27 | + } |
| 28 | + |
| 29 | + public function director(string $url) |
| 30 | + { |
| 31 | + $this->addProperty(self::PREFIX, 'director', $url); |
| 32 | + |
| 33 | + return $this; |
| 34 | + } |
| 35 | + |
| 36 | + public function writer(string $url) |
| 37 | + { |
| 38 | + $this->addProperty(self::PREFIX, 'writer', $url); |
| 39 | + |
| 40 | + return $this; |
| 41 | + } |
| 42 | + |
| 43 | + public function duration(int $seconds) |
| 44 | + { |
| 45 | + $this->setProperty(self::PREFIX, 'duration', $seconds); |
| 46 | + |
| 47 | + return $this; |
| 48 | + } |
| 49 | + |
| 50 | + public function releasedAt(DateTime $releaseDate) |
| 51 | + { |
| 52 | + $this->setProperty(self::PREFIX, 'release_date', $releaseDate->format('Y-m-d')); |
| 53 | + |
| 54 | + return $this; |
| 55 | + } |
| 56 | + |
| 57 | + public function tag(string $tag) |
| 58 | + { |
| 59 | + $this->addProperty(self::PREFIX, 'tag', $tag); |
| 60 | + |
| 61 | + return $this; |
| 62 | + } |
| 63 | +} |
0 commit comments