31 lines
871 B
PHP
31 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Search\Action\Input;
|
|
|
|
use App\Search\Action\Command\GetMediaInfoCommand;
|
|
use OneToMany\RichBundle\Attribute\SourceRoute;
|
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
|
use OneToMany\RichBundle\Contract\InputInterface;
|
|
|
|
/** @implements InputInterface<GetMediaInfoInput> */
|
|
class GetMediaInfoInput implements InputInterface
|
|
{
|
|
public function __construct(
|
|
#[SourceRoute('imdbId')]
|
|
public string $imdbId,
|
|
|
|
#[SourceRoute('mediaType')]
|
|
public string $mediaType,
|
|
|
|
#[SourceRoute('season', nullify: true)]
|
|
public ?int $season,
|
|
) {}
|
|
|
|
public function toCommand(): CommandInterface
|
|
{
|
|
if ("tvshows" === $this->mediaType && null === $this->season) {
|
|
$this->season = 1;
|
|
}
|
|
return new GetMediaInfoCommand($this->imdbId, $this->mediaType, $this->season);
|
|
}
|
|
} |