<?phpnamespace AppBundle\Prismic;use DateTime;use Prismic\Dom\RichText;use stdClass;class Movie{ /** * @var string */ public $uid; /** * @var string */ public $published_at; /** * @var string */ public $title; /** * @var string */ public $subtitle; /** * @var string */ public $imageUrl; /** * @var string */ public $imageAlt; /** * @var string */ public $originalTitle; /** * @var int */ public $runtime; /** * @var string */ public $year; /** * @var string */ public $director; /** * @var string */ public $writers; /** * @var string */ public $cast; /** * @var string */ public $country; /** * @var \DateTime */ public $releaseDate; /** * @var string */ public $youtube; /** * @param stdClass $document */ public function __construct(stdClass $document) { $this->uid = $document->uid; $this->published_at = (new DateTime($document->published_at))->format('d/m/Y'); $this->title = $document->title ?? null; $this->subtitle = $document->subtitle ?? null; $this->imageUrl = $document->image->url ?? null; $this->imageAlt = $document->image->alt ?? null; $this->originalTitle = $document->original_title ?? null; $this->runtime = $document->runtime ?? null; $this->year = $document->year ?? null; $this->director = $document->director ?? null; $this->writers = $document->writers ?? null; $this->cast = $document->cast ?? null; $this->country = $document->country ?? null; $this->releaseDate = $document->release_date ?? null; $this->youtube = $document->youtube ?? null; } /** * @param stdClass $document * * @return self */ public static function create(stdClass $document): self { return new static($document); }}