26 lines
527 B
PHP
26 lines
527 B
PHP
<?php
|
|
|
|
namespace App\Twig\Dto;
|
|
|
|
class EpisodeIdDto
|
|
{
|
|
public function __construct(
|
|
public string $season,
|
|
public string $episode,
|
|
) {}
|
|
|
|
public function asEpisodeId(): string
|
|
{
|
|
return "S". str_pad($this->season, 2, "0", STR_PAD_LEFT) .
|
|
"E". str_pad($this->episode, 2, "0", STR_PAD_LEFT);
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
if ("" !== $this->season && "" !== $this->episode) {
|
|
return $this->asEpisodeId();
|
|
}
|
|
return "";
|
|
}
|
|
}
|