Switch to strings for request params.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-05-24 00:50:43 -05:00
parent a7a779f9f1
commit 693e4378f0
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
133 changed files with 215 additions and 248 deletions

View File

@ -9,13 +9,13 @@ use App\Enums\SupportedLocales;
use App\Http\Factory\ResponseFactory;
use App\Http\Factory\ServerRequestFactory;
use DI;
use Invoker\Invoker;
use Monolog\ErrorHandler;
use Monolog\Registry;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
use Slim\App;
use Slim\Factory\ServerRequestCreatorFactory;
use Slim\Handlers\Strategies\RequestResponseNamedArgs;
class AppFactory
{
@ -54,7 +54,7 @@ class AppFactory
$routeCollector = $app->getRouteCollector();
$routeCollector->setDefaultInvocationStrategy(new ControllerInvoker(new Invoker()));
$routeCollector->setDefaultInvocationStrategy(new RequestResponseNamedArgs());
$environment = $container->get(Environment::class);
if ($environment->isProduction()) {

View File

@ -25,7 +25,7 @@ final class ClearStationQueueAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$testHandler = new TestHandler(Level::Debug, false);
$this->logger->pushHandler($testHandler);

View File

@ -23,7 +23,7 @@ final class NextSongAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$testHandler = new TestHandler(Level::Debug, false);
$this->logger->pushHandler($testHandler);

View File

@ -23,7 +23,7 @@ final class NowPlayingAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$testHandler = new TestHandler(Level::Debug, false);
$this->logger->pushHandler($testHandler);

View File

@ -22,7 +22,7 @@ final class TelnetAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$testHandler = new TestHandler(Level::Debug, false);
$this->logger->pushHandler($testHandler);

View File

@ -47,7 +47,7 @@ abstract class AbstractAdminApiCrudController extends AbstractApiCrudController
public function getAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);
@ -61,11 +61,11 @@ abstract class AbstractAdminApiCrudController extends AbstractApiCrudController
}
/**
* @param mixed $id
* @param string $id
*
* @return TEntity|null
*/
protected function getRecord(mixed $id): ?object
protected function getRecord(string $id): ?object
{
return $this->em->find($this->entityClass, $id);
}
@ -73,7 +73,7 @@ abstract class AbstractAdminApiCrudController extends AbstractApiCrudController
public function editAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);
@ -90,7 +90,7 @@ abstract class AbstractAdminApiCrudController extends AbstractApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);

View File

@ -58,7 +58,7 @@ final class CloneAction extends StationsController
public function __invoke(
ServerRequest $request,
Response $response,
int|string $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);
$data = (array)$request->getParsedBody();

View File

@ -198,7 +198,7 @@ class UsersController extends AbstractAdminApiCrudController
public function editAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);
@ -221,7 +221,7 @@ class UsersController extends AbstractAdminApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($id);

View File

@ -57,7 +57,7 @@ final class ApiKeysController extends AbstractApiCrudController
public function getAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($request->getUser(), $id);
@ -73,7 +73,7 @@ final class ApiKeysController extends AbstractApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
mixed $id
string $id
): ResponseInterface {
$record = $this->getRecord($request->getUser(), $id);

View File

@ -17,7 +17,6 @@ final class DeleteTwoFactorAction
) {
}
public function __invoke(
ServerRequest $request,
Response $response

View File

@ -27,7 +27,7 @@ final class LiquidsoapAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $action
): ResponseInterface {
$station = $request->getStation();

View File

@ -23,7 +23,7 @@ final class ListenerAuthAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -60,7 +60,7 @@ final class NowPlayingAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string|null $station_id = null
?string $station_id = null
): ResponseInterface {
$router = $request->getRouter();
@ -84,7 +84,7 @@ final class NowPlayingAction
}
private function getForStation(
string|int $station,
string $station,
RouterInterface $router
): ?Entity\Api\NowPlaying\NowPlaying {
// Check cache first.

View File

@ -20,7 +20,7 @@ abstract class AbstractStationApiCrudController extends AbstractApiCrudControlle
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $this->getStation($request);
@ -48,7 +48,7 @@ abstract class AbstractStationApiCrudController extends AbstractApiCrudControlle
public function createAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $this->getStation($request);
$row = $this->createRecord((array)$request->getParsedBody(), $station);
@ -82,8 +82,8 @@ abstract class AbstractStationApiCrudController extends AbstractApiCrudControlle
public function getAction(
ServerRequest $request,
Response $response,
int|string $station_id,
mixed $id
string $station_id,
string $id
): ResponseInterface {
$station = $this->getStation($request);
$record = $this->getRecord($station, $id);
@ -116,8 +116,8 @@ abstract class AbstractStationApiCrudController extends AbstractApiCrudControlle
public function editAction(
ServerRequest $request,
Response $response,
int|string $station_id,
mixed $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->getRecord($this->getStation($request), $id);
@ -134,8 +134,8 @@ abstract class AbstractStationApiCrudController extends AbstractApiCrudControlle
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
mixed $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->getRecord($this->getStation($request), $id);

View File

@ -48,8 +48,8 @@ final class DeleteArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int|string $media_id
string $station_id,
string $media_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -48,7 +48,7 @@ final class GetArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $media_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -51,8 +51,8 @@ final class PostArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int|string $media_id
string $station_id,
string $media_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -13,7 +13,7 @@ final class GetSettingsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -20,7 +20,7 @@ final class PutSettingsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -38,7 +38,7 @@ final class RunAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -24,7 +24,7 @@ final class DownloadAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -50,7 +50,7 @@ final class UploadAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -36,7 +36,7 @@ final class DeleteFallbackAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$this->stationRepo->clearFallback($station);

View File

@ -35,7 +35,7 @@ final class GetFallbackAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
set_time_limit(600);

View File

@ -37,7 +37,7 @@ final class PostFallbackAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -46,7 +46,7 @@ final class BatchAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$storageLocation = $station->getMediaStorageLocation();

View File

@ -15,7 +15,7 @@ final class DownloadAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
set_time_limit(600);

View File

@ -27,7 +27,7 @@ final class FlowUploadAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$allParams = $request->getParams();
$station = $request->getStation();

View File

@ -33,7 +33,7 @@ final class ListAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$router = $request->getRouter();

View File

@ -16,7 +16,7 @@ final class ListDirectoriesAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -16,7 +16,7 @@ final class MakeDirectoryAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$currentDir = $request->getParam('currentDirectory', '');
$newDirName = $request->getParam('name', '');

View File

@ -20,8 +20,8 @@ final class PlayAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int|string $id
string $station_id,
string $id
): ResponseInterface {
set_time_limit(600);

View File

@ -21,7 +21,7 @@ final class RenameAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$from = $request->getParam('file');
if (empty($from)) {

View File

@ -166,7 +166,7 @@ final class FilesController extends AbstractStationApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$storageLocation = $this->getStation($request)->getMediaStorageLocation();
@ -183,7 +183,7 @@ final class FilesController extends AbstractStationApiCrudController
public function createAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $this->getStation($request);
@ -220,8 +220,8 @@ final class FilesController extends AbstractStationApiCrudController
public function editAction(
ServerRequest $request,
Response $response,
int|string $station_id,
mixed $id
string $station_id,
string $id
): ResponseInterface {
$station = $this->getStation($request);
$record = $this->getRecord($station, $id);

View File

@ -20,7 +20,7 @@ final class GetQuotaAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $type = null
): ResponseInterface {
$typeEnum = Entity\Enums\StorageLocationTypes::tryFrom($type ?? '')

View File

@ -13,7 +13,7 @@ final class GetRestartStatusAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
return $response->withJson([

View File

@ -69,7 +69,7 @@ final class HistoryController
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
set_time_limit($this->environment->getSyncLongExecutionTime());

View File

@ -59,7 +59,7 @@ final class IndexController
public function indexAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -14,7 +14,7 @@ final class GetAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$backendConfig = $request->getStation()->getBackendConfig();

View File

@ -27,7 +27,7 @@ final class PutAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$body = (array)$request->getParsedBody();

View File

@ -53,7 +53,7 @@ final class ListenersAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$stationTz = $station->getTimezoneObject();

View File

@ -43,8 +43,8 @@ final class DeleteIntroAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$station = $request->getStation();
$mount = $this->mountRepo->find($station, $id);

View File

@ -47,8 +47,8 @@ final class GetIntroAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
set_time_limit(600);

View File

@ -44,8 +44,8 @@ final class PostIntroAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
?int $id = null
string $station_id,
?string $id = null
): ResponseInterface {
$station = $request->getStation();

View File

@ -160,7 +160,7 @@ final class MountsController extends AbstractStationApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -216,7 +216,7 @@ final class MountsController extends AbstractStationApiCrudController
public function createAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -237,8 +237,8 @@ final class MountsController extends AbstractStationApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
mixed $id,
string $station_id,
string $id,
): ResponseInterface {
$record = $this->getRecord($this->getStation($request), $id);

View File

@ -20,7 +20,7 @@ final class DownloadAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $media_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -31,7 +31,7 @@ final class ListAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -15,12 +15,12 @@ abstract class AbstractPlaylistsAction
) {
}
protected function requireRecord(Entity\Station $station, int $id): Entity\StationPlaylist
protected function requireRecord(Entity\Station $station, int|string $id): Entity\StationPlaylist
{
$record = $this->em->getRepository(Entity\StationPlaylist::class)->findOneBy(
[
'station' => $station,
'id' => $id,
'id' => (int)$id,
]
);

View File

@ -16,8 +16,8 @@ final class CloneAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -22,8 +22,8 @@ final class DeleteQueueAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -14,8 +14,8 @@ final class ExportAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id,
string $station_id,
string $id,
string $format = 'pls'
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -15,8 +15,8 @@ final class GetOrderAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$station = $request->getStation();
$record = $this->requireRecord($station, $id);

View File

@ -24,8 +24,8 @@ final class GetQueueAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -25,8 +25,8 @@ final class ImportAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$playlist = $this->requireRecord($request->getStation(), $id);

View File

@ -23,8 +23,8 @@ final class PutOrderAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -22,8 +22,8 @@ final class ReshuffleAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -14,8 +14,8 @@ final class ToggleAction extends AbstractPlaylistsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -148,7 +148,7 @@ final class PlaylistsController extends AbstractScheduledEntityController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -186,7 +186,7 @@ final class PlaylistsController extends AbstractScheduledEntityController
public function scheduleAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -198,7 +198,7 @@ final class PodcastEpisodesController extends AbstractApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$station = $request->getStation();
@ -226,7 +226,7 @@ final class PodcastEpisodesController extends AbstractApiCrudController
public function getAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {
@ -245,7 +245,7 @@ final class PodcastEpisodesController extends AbstractApiCrudController
public function createAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$station = $request->getStation();
@ -289,7 +289,7 @@ final class PodcastEpisodesController extends AbstractApiCrudController
public function editAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {
@ -308,7 +308,7 @@ final class PodcastEpisodesController extends AbstractApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {

View File

@ -45,7 +45,7 @@ final class DeleteArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -47,7 +47,7 @@ final class GetArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -46,7 +46,7 @@ final class PostArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
?string $podcast_id = null
): ResponseInterface {
$station = $request->getStation();

View File

@ -63,7 +63,7 @@ final class DeleteArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {

View File

@ -54,7 +54,7 @@ final class GetArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {

View File

@ -53,7 +53,7 @@ final class PostArtAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
?string $episode_id = null
): ResponseInterface {

View File

@ -50,7 +50,7 @@ final class DeleteMediaAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {

View File

@ -54,7 +54,7 @@ final class GetMediaAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
string $episode_id
): ResponseInterface {

View File

@ -52,7 +52,7 @@ final class PostMediaAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
?string $episode_id = null
): ResponseInterface {

View File

@ -162,7 +162,7 @@ final class PodcastsController extends AbstractApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -186,7 +186,7 @@ final class PodcastsController extends AbstractApiCrudController
public function getAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id,
): ResponseInterface {
$station = $request->getStation();
@ -204,7 +204,7 @@ final class PodcastsController extends AbstractApiCrudController
public function createAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -233,7 +233,7 @@ final class PodcastsController extends AbstractApiCrudController
public function editAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$podcast = $this->getRecord($request->getStation(), $podcast_id);
@ -251,7 +251,7 @@ final class PodcastsController extends AbstractApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $podcast_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -22,7 +22,7 @@ final class ProfileAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$backend = $request->getStationBackend();

View File

@ -22,7 +22,7 @@ final class ProfileEditController extends StationsController
public function getProfileAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -34,7 +34,7 @@ final class ProfileEditController extends StationsController
public function putProfileAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -111,7 +111,7 @@ final class QueueController extends AbstractStationApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$query = $this->queueRepo->getUnplayedQuery($station);
@ -159,7 +159,7 @@ final class QueueController extends AbstractStationApiCrudController
public function clearAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$this->queueRepo->clearUpcomingQueue($station);

View File

@ -149,7 +149,7 @@ final class RemotesController extends AbstractStationApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -23,7 +23,7 @@ final class BestAndWorstAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$station_tz = $station->getTimezoneObject();

View File

@ -22,7 +22,7 @@ final class ChartsAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$station_tz = $station->getTimezoneObject();

View File

@ -23,7 +23,7 @@ final class MostPlayedAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$station_tz = $station->getTimezoneObject();

View File

@ -21,7 +21,7 @@ final class PerformanceAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -23,7 +23,7 @@ final class RequestsController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -66,7 +66,7 @@ final class RequestsController
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
int $request_id
): ResponseInterface {
$station = $request->getStation();
@ -83,7 +83,7 @@ final class RequestsController
public function clearAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$this->requestRepo->clearPendingRequests($station);

View File

@ -27,7 +27,7 @@ final class SoundExchangeAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$tzObject = $station->getTimezoneObject();

View File

@ -76,7 +76,7 @@ final class RequestsController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -184,7 +184,7 @@ final class RequestsController
public function submitAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $media_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -66,7 +66,7 @@ final class ScheduleAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$tz = $station->getTimezoneObject();

View File

@ -111,7 +111,7 @@ final class ServicesController
public function statusAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -131,7 +131,7 @@ final class ServicesController
public function reloadAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
// Reloading attempts to update configuration without restarting broadcasting, if possible and supported.
$station = $request->getStation();
@ -156,7 +156,7 @@ final class ServicesController
public function restartAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
// Restarting will always shut down and restart any services.
$station = $request->getStation();
@ -182,7 +182,7 @@ final class ServicesController
public function frontendAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $do = 'restart'
): ResponseInterface {
$station = $request->getStation();
@ -222,7 +222,7 @@ final class ServicesController
public function backendAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $do = 'restart'
): ResponseInterface {
$station = $request->getStation();

View File

@ -36,7 +36,7 @@ final class DeleteStereoToolConfigurationAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -35,7 +35,7 @@ final class GetStereoToolConfigurationAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
set_time_limit(600);

View File

@ -37,7 +37,7 @@ final class PostStereoToolConfigurationAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -24,8 +24,8 @@ final class BroadcastsController extends AbstractApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id,
?int $id = null
string $station_id,
?string $id = null
): ResponseInterface {
$station = $request->getStation();
@ -125,7 +125,7 @@ final class BroadcastsController extends AbstractApiCrudController
public function downloadAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
int $broadcast_id
): ResponseInterface {
$station = $request->getStation();
@ -157,7 +157,7 @@ final class BroadcastsController extends AbstractApiCrudController
public function deleteAction(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
int $broadcast_id
): ResponseInterface {
$station = $request->getStation();
@ -183,24 +183,24 @@ final class BroadcastsController extends AbstractApiCrudController
return $response->withJson(Entity\Api\Status::deleted());
}
private function getRecord(Entity\Station $station, int $id): ?Entity\StationStreamerBroadcast
private function getRecord(Entity\Station $station, int|string $id): ?Entity\StationStreamerBroadcast
{
/** @var Entity\StationStreamerBroadcast|null $broadcast */
$broadcast = $this->em->getRepository(Entity\StationStreamerBroadcast::class)->findOneBy(
[
'id' => $id,
'id' => (int)$id,
'station' => $station,
]
);
return $broadcast;
}
private function getStreamer(Entity\Station $station, int $id): ?Entity\StationStreamer
private function getStreamer(Entity\Station $station, int|string $id): ?Entity\StationStreamer
{
/** @var Entity\StationStreamer|null $streamer */
$streamer = $this->em->getRepository(Entity\StationStreamer::class)->findOneBy(
[
'id' => $id,
'id' => (int)$id,
'station' => $station,
]
);

View File

@ -149,7 +149,7 @@ final class StreamersController extends AbstractScheduledEntityController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
@ -181,7 +181,7 @@ final class StreamersController extends AbstractScheduledEntityController
public function scheduleAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -16,7 +16,7 @@ final class UpdateMetadataAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();
$backend = $request->getStationBackend();

View File

@ -22,7 +22,7 @@ final class GetWaveformAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $media_id
): ResponseInterface {
$response = $response->withCacheLifetime(Response::CACHE_ONE_YEAR);

View File

@ -15,12 +15,12 @@ abstract class AbstractWebhooksAction
) {
}
protected function requireRecord(Entity\Station $station, int $id): Entity\StationWebhook
protected function requireRecord(Entity\Station $station, int|string $id): Entity\StationWebhook
{
$record = $this->em->getRepository(Entity\StationWebhook::class)->findOneBy(
[
'station' => $station,
'id' => $id,
'id' => (int)$id,
]
);

View File

@ -24,16 +24,16 @@ final class TestAction extends AbstractWebhooksAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$this->requireRecord($request->getStation(), $id);
$webhook = $this->requireRecord($request->getStation(), $id);
$tempFile = File::generateTempPath('webhook_test_' . $id . '.log');
touch($tempFile);
$message = new TestWebhookMessage();
$message->webhookId = $id;
$message->webhookId = $webhook->getIdRequired();
$message->outputPath = $tempFile;
$this->messageBus->dispatch($message);

View File

@ -18,8 +18,8 @@ final class TestLogAction extends AbstractWebhooksAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id,
string $station_id,
string $id,
string $path
): ResponseInterface {
$this->requireRecord($request->getStation(), $id);

View File

@ -14,8 +14,8 @@ final class ToggleAction extends AbstractWebhooksAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
int $id
string $station_id,
string $id
): ResponseInterface {
$record = $this->requireRecord($request->getStation(), $id);

View File

@ -152,7 +152,7 @@ final class WebhooksController extends AbstractStationApiCrudController
public function listAction(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -23,7 +23,7 @@ final class MasqueradeAction
public function __invoke(
ServerRequest $request,
Response $response,
int $id,
string $id,
string $csrf
): ResponseInterface {
$request->getCsrf()->verify($csrf, self::CSRF_NAMESPACE);

View File

@ -14,7 +14,8 @@ final class AppManifestAction
{
public function __invoke(
ServerRequest $request,
Response $response
Response $response,
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -20,7 +20,7 @@ final class HistoryAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id
string $station_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -21,8 +21,8 @@ final class OnDemandAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
bool $embed = false
string $station_id,
?string $embed = null
): ResponseInterface {
$station = $request->getStation();
@ -54,7 +54,7 @@ final class OnDemandAction
$router = $request->getRouter();
$pageClass = 'ondemand station-' . $station->getShortName();
if ($embed) {
if (null !== $embed) {
$pageClass .= ' embed';
}

View File

@ -23,7 +23,7 @@ final class PlayerAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
?string $embed = null,
): ResponseInterface {
$station = $request->getStation();

View File

@ -14,7 +14,7 @@ final class PlaylistAction
public function __invoke(
ServerRequest $request,
Response $response,
int|string $station_id,
string $station_id,
string $format = 'pls'
): ResponseInterface {
$station = $request->getStation();

Some files were not shown because too many files have changed in this diff Show More