2019-09-10 23:10:57 +00:00
|
|
|
<?php
|
2020-10-14 22:19:31 +00:00
|
|
|
|
2021-07-19 05:53:45 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-09-10 23:10:57 +00:00
|
|
|
namespace App\Console\Command\Internal;
|
|
|
|
|
2020-06-26 20:22:53 +00:00
|
|
|
use App\Console\Command\CommandAbstract;
|
2019-09-10 23:10:57 +00:00
|
|
|
use App\Entity;
|
|
|
|
use App\Radio\AutoDJ;
|
2020-06-26 20:22:53 +00:00
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
2019-09-10 23:10:57 +00:00
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
|
|
|
|
class NextSongCommand extends CommandAbstract
|
|
|
|
{
|
|
|
|
public function __invoke(
|
|
|
|
SymfonyStyle $io,
|
2020-06-26 20:22:53 +00:00
|
|
|
EntityManagerInterface $em,
|
2019-09-10 23:10:57 +00:00
|
|
|
AutoDJ $autoDJ,
|
|
|
|
int $stationId,
|
|
|
|
bool $asAutodj = false
|
2020-10-14 22:19:31 +00:00
|
|
|
): int {
|
2019-09-10 23:10:57 +00:00
|
|
|
$station = $em->find(Entity\Station::class, $stationId);
|
|
|
|
|
|
|
|
if (!($station instanceof Entity\Station)) {
|
|
|
|
$io->write('false');
|
2020-10-14 22:19:31 +00:00
|
|
|
return 0;
|
2019-09-10 23:10:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$io->write($autoDJ->annotateNextSong($station, $asAutodj));
|
2020-10-14 22:19:31 +00:00
|
|
|
return 0;
|
2019-09-10 23:10:57 +00:00
|
|
|
}
|
|
|
|
}
|