Implement LoggerAwareTrait and ContainerAwareTrait.
This commit is contained in:
parent
2be71a2c04
commit
108872c6cb
|
@ -223,7 +223,8 @@ return [
|
|||
DI\Container $di,
|
||||
App\Plugins $plugins
|
||||
) {
|
||||
$dispatcher = new App\CallableEventDispatcher($di);
|
||||
$dispatcher = new App\CallableEventDispatcher();
|
||||
$dispatcher->setContainer($di);
|
||||
|
||||
// Register application default events.
|
||||
if (file_exists(__DIR__ . '/events.php')) {
|
||||
|
|
|
@ -87,6 +87,7 @@ final class AppFactory
|
|||
|
||||
$containerBuilder = new DI\ContainerBuilder();
|
||||
$containerBuilder->useAutowiring(true);
|
||||
$containerBuilder->useAttributes(true);
|
||||
|
||||
if ($environment->isProduction()) {
|
||||
$containerBuilder->enableCompilation($environment->getTempDirectory());
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
use function is_array;
|
||||
|
@ -12,11 +12,7 @@ use function is_string;
|
|||
|
||||
final class CallableEventDispatcher extends EventDispatcher implements CallableEventDispatcherInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ContainerInterface $di
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
use ContainerAwareTrait;
|
||||
|
||||
/**
|
||||
* @param array|class-string $className
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Console\Command;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Environment;
|
||||
use App\Version;
|
||||
use OpenApi\Annotations\OpenApi;
|
||||
use OpenApi\Generator;
|
||||
use OpenApi\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -21,10 +21,11 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
|||
)]
|
||||
final class GenerateApiDocsCommand extends CommandAbstract
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Environment $environment,
|
||||
private readonly Version $version,
|
||||
private readonly LoggerInterface $logger
|
||||
private readonly Version $version
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ namespace App\Console\Command\MessageQueue;
|
|||
|
||||
use App\CallableEventDispatcherInterface;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\Messenger\ClearEntityManagerSubscriber;
|
||||
use App\Environment;
|
||||
use App\MessageQueue\LogWorkerExceptionSubscriber;
|
||||
use App\MessageQueue\QueueManagerInterface;
|
||||
use App\MessageQueue\ResetArrayCacheSubscriber;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
use Psr\Log\NullLogger;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -32,11 +32,12 @@ use Throwable;
|
|||
)]
|
||||
final class ProcessCommand extends CommandAbstract
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly MessageBus $messageBus,
|
||||
private readonly CallableEventDispatcherInterface $eventDispatcher,
|
||||
private readonly QueueManagerInterface $queueManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly Environment $environment,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Console\Command;
|
||||
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Environment;
|
||||
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
|
||||
use Doctrine\Common\DataFixtures\Loader;
|
||||
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -23,9 +23,10 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
|||
)]
|
||||
final class SetupFixturesCommand extends CommandAbstract
|
||||
{
|
||||
use ContainerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly ContainerInterface $di,
|
||||
private readonly Environment $environment,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -5,9 +5,9 @@ declare(strict_types=1);
|
|||
namespace App\Console\Command\Sync;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Environment;
|
||||
use App\Lock\LockFactory;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Lock\Lock;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
@ -16,10 +16,11 @@ use function random_int;
|
|||
|
||||
abstract class AbstractSyncCommand extends CommandAbstract
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
protected array $processes = [];
|
||||
|
||||
public function __construct(
|
||||
protected LoggerInterface $logger,
|
||||
protected LockFactory $lockFactory,
|
||||
protected Environment $environment,
|
||||
) {
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Entity\Repository\SettingsRepository;
|
|||
use App\Environment;
|
||||
use App\Lock\LockFactory;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -27,14 +26,13 @@ final class NowPlayingCommand extends AbstractSyncCommand
|
|||
public final const MAX_CONCURRENT_PROCESSES = 5;
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $logger,
|
||||
LockFactory $lockFactory,
|
||||
Environment $environment,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly SettingsRepository $settingsRepo,
|
||||
private readonly NowPlayingCache $nowPlayingCache
|
||||
) {
|
||||
parent::__construct($logger, $lockFactory, $environment);
|
||||
parent::__construct($lockFactory, $environment);
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
|
|
|
@ -5,11 +5,11 @@ declare(strict_types=1);
|
|||
namespace App\Console\Command\Sync;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Repository\StationRepository;
|
||||
use App\Entity\Station;
|
||||
use App\Sync\NowPlaying\Task\BuildQueueTask;
|
||||
use App\Sync\NowPlaying\Task\NowPlayingTask;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
@ -24,11 +24,12 @@ use Throwable;
|
|||
)]
|
||||
final class NowPlayingPerStationCommand extends CommandAbstract
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly StationRepository $stationRepo,
|
||||
private readonly BuildQueueTask $buildQueueTask,
|
||||
private readonly NowPlayingTask $nowPlayingTask,
|
||||
private readonly Logger $logger,
|
||||
private readonly NowPlayingTask $nowPlayingTask
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ use Carbon\CarbonImmutable;
|
|||
use Cron\CronExpression;
|
||||
use DateTimeZone;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -28,13 +27,12 @@ use function usleep;
|
|||
final class RunnerCommand extends AbstractSyncCommand
|
||||
{
|
||||
public function __construct(
|
||||
LoggerInterface $logger,
|
||||
LockFactory $lockFactory,
|
||||
Environment $environment,
|
||||
private readonly EventDispatcherInterface $dispatcher,
|
||||
private readonly SettingsRepository $settingsRepo,
|
||||
) {
|
||||
parent::__construct($logger, $lockFactory, $environment);
|
||||
parent::__construct($lockFactory, $environment);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
|
|
|
@ -5,11 +5,11 @@ declare(strict_types=1);
|
|||
namespace App\Console\Command\Sync;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Sync\Task\AbstractTask;
|
||||
use InvalidArgumentException;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use ReflectionClass;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -24,10 +24,11 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
|||
)]
|
||||
final class SingleTaskCommand extends CommandAbstract
|
||||
{
|
||||
use ContainerAwareTrait;
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly ContainerInterface $di,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly Logger $logger,
|
||||
private readonly CacheInterface $cache
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Console;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use Symfony\Component\Console\ConsoleEvents;
|
||||
use Symfony\Component\Console\Event\ConsoleErrorEvent;
|
||||
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
||||
|
@ -12,10 +12,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
|
||||
final class ErrorHandler implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Container;
|
||||
|
||||
use DI\Attribute\Inject;
|
||||
use DI\Container;
|
||||
|
||||
trait ContainerAwareTrait
|
||||
{
|
||||
protected Container $di;
|
||||
|
||||
#[Inject]
|
||||
public function setContainer(Container $container): void
|
||||
{
|
||||
$this->di = $container;
|
||||
}
|
||||
|
||||
public function getContainer(): Container
|
||||
{
|
||||
return $this->di;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Container;
|
||||
|
||||
use DI\Attribute\Inject;
|
||||
use Monolog\Logger;
|
||||
|
||||
trait LoggerAwareTrait
|
||||
{
|
||||
protected Logger $logger;
|
||||
|
||||
#[Inject]
|
||||
public function setLogger(Logger $logger): void
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function getLogger(): Logger
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
}
|
|
@ -4,19 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Admin\Debug;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Repository\StationQueueRepository;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\AutoDJ\Queue;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class ClearStationQueueAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly StationQueueRepository $queueRepo,
|
||||
private readonly Queue $queue,
|
||||
) {
|
||||
|
|
|
@ -4,18 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Admin\Debug;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\AutoDJ\Annotations;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class NextSongAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly Annotations $annotations
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,18 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Admin\Debug;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Sync\NowPlaying\Task\NowPlayingTask;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class NowPlayingAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly NowPlayingTask $nowPlayingTask
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -5,19 +5,20 @@ declare(strict_types=1);
|
|||
namespace App\Controller\Admin\Debug;
|
||||
|
||||
use App\Console\Command\Sync\SingleTaskCommand;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Event\GetSyncTasks;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class SyncAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly SingleTaskCommand $taskCommand,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
) {
|
||||
|
|
|
@ -4,19 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Admin\Debug;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Exception\StationUnsupportedException;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Adapters;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class TelnetAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly Adapters $adapters
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,25 +4,22 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Api\Internal;
|
||||
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Enums\StationPermissions;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Backend\Liquidsoap\Command\AbstractCommand;
|
||||
use App\Radio\Enums\LiquidsoapCommands;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
final class LiquidsoapAction
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ContainerInterface $di,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
use ContainerAwareTrait;
|
||||
|
||||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
|
|
|
@ -4,18 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Api\Internal;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Enums\StationPermissions;
|
||||
use App\Exception\PermissionDeniedException;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Frontend\Blocklist\BlocklistParser;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class ListenerAuthAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly BlocklistParser $blocklistParser
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,18 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Api\Internal;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\SftpUser;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class SftpAuthAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly EntityManagerInterface $em
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Api\Internal;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Repository\StorageLocationRepository;
|
||||
use App\Entity\SftpUser;
|
||||
use App\Entity\StorageLocation;
|
||||
|
@ -15,16 +16,16 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use League\Flysystem\PathPrefixer;
|
||||
use LogicException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Messenger\MessageBus;
|
||||
use Throwable;
|
||||
|
||||
final class SftpEventAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly MessageBus $messageBus,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly BatchUtilities $batchUtilities,
|
||||
private readonly StorageLocationRepository $storageLocationRepo
|
||||
) {
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\Api\Stations\Files;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Exception\CannotProcessMediaException;
|
||||
use App\Exception\StorageLocationFullException;
|
||||
|
@ -13,15 +14,15 @@ use App\Media\MediaProcessor;
|
|||
use App\Service\Flow;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class FlowUploadAction
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly MediaProcessor $mediaProcessor,
|
||||
private readonly Entity\Repository\StationPlaylistMediaRepository $spmRepo,
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\ApiGenerator;
|
||||
|
||||
use App\Cache\NowPlayingCache;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Api\NowPlaying\CurrentSong;
|
||||
use App\Entity\Api\NowPlaying\Listeners;
|
||||
use App\Entity\Api\NowPlaying\Live;
|
||||
|
@ -16,7 +17,6 @@ use App\Entity\Song;
|
|||
use App\Entity\Station;
|
||||
use App\Entity\StationQueue;
|
||||
use App\Http\Router;
|
||||
use App\Utilities\Logger;
|
||||
use Exception;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use NowPlaying\Result\Result;
|
||||
|
@ -25,6 +25,8 @@ use RuntimeException;
|
|||
|
||||
final class NowPlayingApiGenerator
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly SongApiGenerator $songApiGenerator,
|
||||
private readonly SongHistoryApiGenerator $songHistoryApiGenerator,
|
||||
|
@ -83,7 +85,7 @@ final class NowPlayingApiGenerator
|
|||
throw new RuntimeException('No current song.');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logger::getInstance()->error($e->getMessage(), ['exception' => $e]);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
|
||||
return $this->offlineApi($station, $baseUri);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Repository;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Doctrine\Repository;
|
||||
use App\Entity;
|
||||
|
@ -15,7 +16,6 @@ use DateTimeInterface;
|
|||
use Doctrine\DBAL\Connection;
|
||||
use League\Csv\Writer;
|
||||
use NowPlaying\Result\Client;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Throwable;
|
||||
|
||||
|
@ -24,6 +24,7 @@ use Throwable;
|
|||
*/
|
||||
final class ListenerRepository extends Repository
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
use Entity\Traits\TruncateStrings;
|
||||
|
||||
private string $tableName;
|
||||
|
@ -33,8 +34,7 @@ final class ListenerRepository extends Repository
|
|||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
private readonly DeviceDetector $deviceDetector,
|
||||
private readonly IpGeolocation $ipGeolocation,
|
||||
private readonly LoggerInterface $logger
|
||||
private readonly IpGeolocation $ipGeolocation
|
||||
) {
|
||||
parent::__construct($em);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Repository;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Doctrine\Repository;
|
||||
use App\Entity;
|
||||
|
@ -13,7 +14,6 @@ use App\Media\AlbumArt;
|
|||
use App\Media\MetadataManager;
|
||||
use App\Media\RemoteAlbumArt;
|
||||
use App\Service\AudioWaveform;
|
||||
use App\Utilities\Logger;
|
||||
use Exception;
|
||||
use Generator;
|
||||
use League\Flysystem\FilesystemException;
|
||||
|
@ -27,6 +27,8 @@ use const JSON_UNESCAPED_SLASHES;
|
|||
*/
|
||||
final class StationMediaRepository extends Repository
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
private readonly MetadataManager $metadataManager,
|
||||
|
@ -195,7 +197,7 @@ final class StationMediaRepository extends Repository
|
|||
try {
|
||||
$this->writeAlbumArt($media, $artwork, $fs);
|
||||
} catch (Exception $exception) {
|
||||
Logger::getInstance()->error(
|
||||
$this->logger->error(
|
||||
sprintf(
|
||||
'Album Artwork for "%s" could not be processed: "%s"',
|
||||
$filePath,
|
||||
|
|
|
@ -4,26 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Repository;
|
||||
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Doctrine\Repository;
|
||||
use App\Entity\Enums\StorageLocationAdapters;
|
||||
use App\Entity\Enums\StorageLocationTypes;
|
||||
use App\Entity\Station;
|
||||
use App\Entity\StorageLocation;
|
||||
use App\Entity\StorageLocationAdapter\StorageLocationAdapterInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @extends Repository<StorageLocation>
|
||||
*/
|
||||
final class StorageLocationRepository extends Repository
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ContainerInterface $adapters,
|
||||
ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
parent::__construct($em);
|
||||
}
|
||||
use ContainerAwareTrait;
|
||||
|
||||
public function findByType(
|
||||
string|StorageLocationTypes $type,
|
||||
|
@ -139,12 +133,12 @@ final class StorageLocationRepository extends Repository
|
|||
{
|
||||
$adapterClass = $storageLocation->getAdapter()->getAdapterClass();
|
||||
|
||||
if (!$this->adapters->has($adapterClass)) {
|
||||
if (!$this->di->has($adapterClass)) {
|
||||
throw new \InvalidArgumentException(sprintf('Class not found: %s', $adapterClass));
|
||||
}
|
||||
|
||||
/** @var StorageLocationAdapterInterface $adapter */
|
||||
$adapter = $this->adapters->get($adapterClass);
|
||||
$adapter = $this->di->get($adapterClass);
|
||||
return $adapter->withStorageLocation($storageLocation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,19 +4,16 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Media\AlbumArtHandler;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Event\Media\GetAlbumArt;
|
||||
use App\Exception\RateLimitExceededException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
abstract class AbstractAlbumArtHandler
|
||||
{
|
||||
public function __construct(
|
||||
protected LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __invoke(GetAlbumArt $event): void
|
||||
{
|
||||
|
|
|
@ -6,15 +6,12 @@ namespace App\Media\AlbumArtHandler;
|
|||
|
||||
use App\Entity;
|
||||
use App\Service\LastFm;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class LastFmAlbumArtHandler extends AbstractAlbumArtHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly LastFm $lastFm,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function getServiceName(): string
|
||||
|
|
|
@ -6,15 +6,12 @@ namespace App\Media\AlbumArtHandler;
|
|||
|
||||
use App\Entity;
|
||||
use App\Service\MusicBrainz;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class MusicBrainzAlbumArtHandler extends AbstractAlbumArtHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly MusicBrainz $musicBrainz,
|
||||
LoggerInterface $logger
|
||||
private readonly MusicBrainz $musicBrainz
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function getServiceName(): string
|
||||
|
|
|
@ -4,22 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Media\Metadata\Reader;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Event\Media\ReadMetadata;
|
||||
use App\Media\Metadata;
|
||||
use App\Utilities\Arrays;
|
||||
use App\Utilities\Strings;
|
||||
use App\Utilities\Time;
|
||||
use JamesHeinrich\GetID3\GetID3;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
final class PhpReader
|
||||
{
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __invoke(ReadMetadata $event): void
|
||||
{
|
||||
|
|
|
@ -4,18 +4,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Media;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Event\Media\ReadMetadata;
|
||||
use App\Event\Media\WriteMetadata;
|
||||
use App\Exception\CannotProcessMediaException;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
|
||||
final class MetadataManager
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly EventDispatcherInterface $eventDispatcher
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -6,22 +6,23 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Media;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Event\Media\GetAlbumArt;
|
||||
use App\Version;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use Throwable;
|
||||
|
||||
final class RemoteAlbumArt
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public const CACHE_LIFETIME = 86400 * 14; // Two Weeks
|
||||
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
|
|
|
@ -4,16 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\MessageQueue;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
|
||||
|
||||
final class LogWorkerExceptionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
|
|
@ -4,17 +4,18 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Nginx;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Station;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use JsonException;
|
||||
use NowPlaying\Result\Client;
|
||||
use NowPlaying\Result\Result;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class HlsListeners
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly EntityManagerInterface $em,
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Environment;
|
||||
use App\Exception\Supervisor\AlreadyRunningException;
|
||||
|
@ -12,19 +13,19 @@ use App\Exception\SupervisorException;
|
|||
use App\Http\Router;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Supervisor\Exception\Fault;
|
||||
use Supervisor\Exception\SupervisorException as SupervisorLibException;
|
||||
use Supervisor\SupervisorInterface;
|
||||
|
||||
abstract class AbstractLocalAdapter
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
protected Environment $environment,
|
||||
protected EntityManagerInterface $em,
|
||||
protected SupervisorInterface $supervisor,
|
||||
protected EventDispatcherInterface $dispatcher,
|
||||
protected LoggerInterface $logger,
|
||||
protected Router $router,
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio;
|
||||
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Exception\NotFoundException;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
|
@ -11,24 +12,20 @@ use App\Radio\Enums\AdapterTypeInterface;
|
|||
use App\Radio\Enums\BackendAdapters;
|
||||
use App\Radio\Enums\FrontendAdapters;
|
||||
use App\Radio\Enums\RemoteAdapters;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Manager class for radio adapters.
|
||||
*/
|
||||
final class Adapters
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ContainerInterface $adapters
|
||||
) {
|
||||
}
|
||||
use ContainerAwareTrait;
|
||||
|
||||
public function getFrontendAdapter(Entity\Station $station): ?Frontend\AbstractFrontend
|
||||
{
|
||||
$className = $station->getFrontendType()->getClass();
|
||||
|
||||
return (null !== $className && $this->adapters->has($className))
|
||||
? $this->adapters->get($className)
|
||||
return (null !== $className && $this->di->has($className))
|
||||
? $this->di->get($className)
|
||||
: null;
|
||||
}
|
||||
|
||||
|
@ -45,8 +42,8 @@ final class Adapters
|
|||
{
|
||||
$className = $station->getBackendType()->getClass();
|
||||
|
||||
return (null !== $className && $this->adapters->has($className))
|
||||
? $this->adapters->get($className)
|
||||
return (null !== $className && $this->di->has($className))
|
||||
? $this->di->get($className)
|
||||
: null;
|
||||
}
|
||||
|
||||
|
@ -62,8 +59,8 @@ final class Adapters
|
|||
public function getRemoteAdapter(Entity\StationRemote $remote): Remote\AbstractRemote
|
||||
{
|
||||
$class_name = $remote->getType()->getClass();
|
||||
if ($this->adapters->has($class_name)) {
|
||||
return $this->adapters->get($class_name);
|
||||
if ($this->di->has($class_name)) {
|
||||
return $this->di->get($class_name);
|
||||
}
|
||||
|
||||
throw new NotFoundException('Adapter not found: ' . $class_name);
|
||||
|
@ -102,7 +99,7 @@ final class Adapters
|
|||
}
|
||||
|
||||
/** @var AbstractLocalAdapter $adapter */
|
||||
$adapter = $this->adapters->get($adapter_info['class']);
|
||||
$adapter = $this->di->get($adapter_info['class']);
|
||||
return $adapter->isInstalled();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -4,11 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\AutoDJ;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class DuplicatePrevention
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public const ARTIST_SEPARATORS = [
|
||||
', ',
|
||||
' feat ',
|
||||
|
@ -20,11 +22,6 @@ final class DuplicatePrevention
|
|||
' vs. ',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
protected Logger $logger
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity\Api\StationPlaylistQueue[] $eligibleTracks
|
||||
* @param array $playedTracks
|
||||
|
|
|
@ -4,13 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\AutoDJ;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Event\Radio\BuildQueue;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Carbon\CarbonInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
|
@ -21,9 +21,10 @@ use Psr\SimpleCache\CacheInterface;
|
|||
*/
|
||||
final class Queue
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly Logger $logger,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly EventDispatcherInterface $dispatcher,
|
||||
private readonly Entity\Repository\StationQueueRepository $queueRepo,
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\AutoDJ;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Event\Radio\BuildQueue;
|
||||
use App\Radio\PlaylistParser;
|
||||
use Carbon\CarbonInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Logger;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
|
@ -18,9 +18,10 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
*/
|
||||
final class QueueBuilder implements EventSubscriberInterface
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly Logger $logger,
|
||||
private readonly Scheduler $scheduler,
|
||||
private readonly DuplicatePrevention $duplicatePrevention,
|
||||
private readonly CacheInterface $cache,
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\AutoDJ;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use App\Entity\Repository\StationPlaylistMediaRepository;
|
||||
|
@ -12,13 +13,13 @@ use App\Utilities\DateRange;
|
|||
use Carbon\CarbonImmutable;
|
||||
use Carbon\CarbonInterface;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
|
||||
final class Scheduler
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly StationPlaylistMediaRepository $spmRepo,
|
||||
private readonly StationQueueRepository $queueRepo,
|
||||
private readonly ReloadableEntityManagerInterface $em,
|
||||
|
|
|
@ -4,19 +4,16 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\Backend\Liquidsoap\Command;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Radio\Enums\BackendAdapters;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
use ReflectionClass;
|
||||
use Throwable;
|
||||
|
||||
abstract class AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
protected Logger $logger
|
||||
) {
|
||||
}
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function run(
|
||||
Entity\Station $station,
|
||||
|
|
|
@ -6,16 +6,13 @@ namespace App\Radio\Backend\Liquidsoap\Command;
|
|||
|
||||
use App\Entity;
|
||||
use App\Flysystem\StationFilesystems;
|
||||
use Monolog\Logger;
|
||||
use RuntimeException;
|
||||
|
||||
final class CopyCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
private readonly StationFilesystems $stationFilesystems,
|
||||
Logger $logger
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(Entity\Station $station, bool $asAutoDj = false, array $payload = []): string
|
||||
|
|
|
@ -5,16 +5,13 @@ declare(strict_types=1);
|
|||
namespace App\Radio\Backend\Liquidsoap\Command;
|
||||
|
||||
use App\Entity;
|
||||
use Monolog\Logger;
|
||||
use RuntimeException;
|
||||
|
||||
final class DjAuthCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
private readonly Entity\Repository\StationStreamerRepository $streamerRepo,
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(
|
||||
|
|
|
@ -5,15 +5,12 @@ declare(strict_types=1);
|
|||
namespace App\Radio\Backend\Liquidsoap\Command;
|
||||
|
||||
use App\Entity;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class DjOffCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
private readonly Entity\Repository\StationStreamerRepository $streamerRepo,
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(
|
||||
|
|
|
@ -5,15 +5,12 @@ declare(strict_types=1);
|
|||
namespace App\Radio\Backend\Liquidsoap\Command;
|
||||
|
||||
use App\Entity;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class DjOnCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
private readonly Entity\Repository\StationStreamerRepository $streamerRepo,
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(
|
||||
|
|
|
@ -7,18 +7,15 @@ namespace App\Radio\Backend\Liquidsoap\Command;
|
|||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Monolog\Logger;
|
||||
use RuntimeException;
|
||||
|
||||
final class FeedbackCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly Entity\Repository\StationQueueRepository $queueRepo,
|
||||
private readonly Entity\Repository\SongHistoryRepository $historyRepo
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(
|
||||
|
|
|
@ -6,15 +6,12 @@ namespace App\Radio\Backend\Liquidsoap\Command;
|
|||
|
||||
use App\Entity;
|
||||
use App\Radio\AutoDJ\Annotations;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class NextSongCommand extends AbstractCommand
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
private readonly Annotations $annotations
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
protected function doRun(
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\Backend\Liquidsoap;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use App\Event\Radio\AnnotateNextSong;
|
||||
|
@ -14,15 +15,15 @@ use App\Message;
|
|||
use App\Radio\Backend\Liquidsoap;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Throwable;
|
||||
|
||||
final class PlaylistFileWriter implements EventSubscriberInterface
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly ReloadableEntityManagerInterface $em,
|
||||
private readonly Filesystem $fsUtils,
|
||||
|
|
|
@ -21,7 +21,6 @@ use PhpIP\IP;
|
|||
use PhpIP\IPBlock;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Supervisor\SupervisorInterface;
|
||||
|
||||
abstract class AbstractFrontend extends AbstractLocalAdapter
|
||||
|
@ -31,14 +30,13 @@ abstract class AbstractFrontend extends AbstractLocalAdapter
|
|||
EntityManagerInterface $em,
|
||||
SupervisorInterface $supervisor,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
LoggerInterface $logger,
|
||||
Router $router,
|
||||
protected AdapterFactory $adapterFactory,
|
||||
protected Client $http_client,
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo,
|
||||
protected Entity\Repository\StationMountRepository $stationMountRepo,
|
||||
) {
|
||||
parent::__construct($environment, $em, $supervisor, $dispatcher, $logger, $router);
|
||||
parent::__construct($environment, $em, $supervisor, $dispatcher, $router);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,22 +4,23 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Radio\Remote;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use Monolog\Logger;
|
||||
use NowPlaying\AdapterFactory;
|
||||
use NowPlaying\Enums\AdapterTypes;
|
||||
use NowPlaying\Result\Result;
|
||||
|
||||
abstract class AbstractRemote
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
protected EntityManagerInterface $em,
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo,
|
||||
protected Client $http_client,
|
||||
protected Logger $logger,
|
||||
protected AdapterFactory $adapterFactory
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ use GuzzleHttp\Promise\Create;
|
|||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use InvalidArgumentException;
|
||||
use Monolog\Logger;
|
||||
use NowPlaying\AdapterFactory;
|
||||
use NowPlaying\Enums\AdapterTypes;
|
||||
use NowPlaying\Result\Result;
|
||||
|
@ -24,11 +23,10 @@ final class AzuraRelay extends AbstractRemote
|
|||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Client $http_client,
|
||||
Logger $logger,
|
||||
AdapterFactory $adapterFactory,
|
||||
private readonly AzuraRelayCache $azuraRelayCache
|
||||
) {
|
||||
parent::__construct($em, $settingsRepo, $http_client, $logger, $adapterFactory);
|
||||
parent::__construct($em, $settingsRepo, $http_client, $adapterFactory);
|
||||
}
|
||||
|
||||
public function getNowPlayingAsync(Entity\StationRemote $remote, bool $includeClients = false): PromiseInterface
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\Repository\SettingsRepository;
|
||||
use App\Entity\Repository\StationRepository;
|
||||
use App\Environment;
|
||||
|
@ -13,7 +14,6 @@ use App\Nginx\Nginx;
|
|||
use App\Radio\Adapters;
|
||||
use Exception;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Logger;
|
||||
use Psr\Log\LogLevel;
|
||||
use RuntimeException;
|
||||
use skoerfgen\ACMECert\ACMECert;
|
||||
|
@ -21,6 +21,8 @@ use Symfony\Component\Filesystem\Filesystem;
|
|||
|
||||
final class Acme
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public const LETSENCRYPT_PROD = 'https://acme-v02.api.letsencrypt.org/directory';
|
||||
public const LETSENCRYPT_DEV = 'https://acme-staging-v02.api.letsencrypt.org/directory';
|
||||
public const THRESHOLD_DAYS = 30;
|
||||
|
@ -29,7 +31,6 @@ final class Acme
|
|||
private readonly SettingsRepository $settingsRepo,
|
||||
private readonly StationRepository $stationRepo,
|
||||
private readonly Environment $environment,
|
||||
private readonly Logger $logger,
|
||||
private readonly Nginx $nginx,
|
||||
private readonly Adapters $adapters,
|
||||
) {
|
||||
|
|
|
@ -4,22 +4,23 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Environment;
|
||||
use App\Version;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class AzuraCastCentral
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
private const BASE_URL = 'https://central.azuracast.com';
|
||||
|
||||
public function __construct(
|
||||
private readonly Environment $environment,
|
||||
private readonly Version $version,
|
||||
private readonly Client $httpClient,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace App\Sync\NowPlaying\Task;
|
||||
|
||||
use App\Cache\NowPlayingCache;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity\Api\NowPlaying\NowPlaying;
|
||||
use App\Entity\ApiGenerator\NowPlayingApiGenerator;
|
||||
|
@ -23,12 +24,13 @@ use Exception;
|
|||
use GuzzleHttp\Promise\Utils;
|
||||
use NowPlaying\Result\Result;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Messenger\MessageBus;
|
||||
|
||||
final class NowPlayingTask implements NowPlayingTaskInterface, EventSubscriberInterface
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Adapters $adapters,
|
||||
private readonly NowPlayingCache $nowPlayingCache,
|
||||
|
@ -39,7 +41,6 @@ final class NowPlayingTask implements NowPlayingTaskInterface, EventSubscriberIn
|
|||
private readonly SettingsRepository $settingsRepo,
|
||||
private readonly NowPlayingApiGenerator $nowPlayingApiGenerator,
|
||||
private readonly ReloadableEntityManagerInterface $em,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly HlsListeners $hlsListeners,
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Sync\Task;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Doctrine\ReadWriteBatchIteratorAggregate;
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class AbstractTask implements ScheduledTaskInterface
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
protected ReloadableEntityManagerInterface $em,
|
||||
protected LoggerInterface $logger
|
||||
protected ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -9,17 +9,15 @@ use App\Entity;
|
|||
use App\Flysystem\ExtendedFilesystemInterface;
|
||||
use App\Flysystem\StationFilesystems;
|
||||
use Doctrine\ORM\Query;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class CheckFolderPlaylistsTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Entity\Repository\StationPlaylistMediaRepository $spmRepo,
|
||||
private readonly StationFilesystems $stationFilesystems,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -20,7 +20,6 @@ use Doctrine\ORM\AbstractQuery;
|
|||
use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use League\Flysystem\UnableToRetrieveMetadata;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use Symfony\Component\Messenger\MessageBus;
|
||||
|
||||
|
@ -33,9 +32,8 @@ final class CheckMediaTask extends AbstractTask
|
|||
private readonly MessageBus $messageBus,
|
||||
private readonly QueueManagerInterface $queueManager,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -11,7 +11,6 @@ use App\Radio\Adapters;
|
|||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Radio\Enums\LiquidsoapQueues;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class CheckRequestsTask extends AbstractTask
|
||||
{
|
||||
|
@ -19,10 +18,9 @@ final class CheckRequestsTask extends AbstractTask
|
|||
private readonly Entity\Repository\StationRequestRepository $requestRepo,
|
||||
private readonly Adapters $adapters,
|
||||
private readonly EventDispatcherInterface $dispatcher,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Entity;
|
|||
use App\Environment;
|
||||
use App\Service\AzuraCastCentral;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class CheckUpdatesTask extends AbstractTask
|
||||
{
|
||||
|
@ -19,9 +18,8 @@ final class CheckUpdatesTask extends AbstractTask
|
|||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||
private readonly AzuraCastCentral $azuracastCentral,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -6,7 +6,6 @@ namespace App\Sync\Task;
|
|||
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class CleanupHistoryTask extends AbstractTask
|
||||
{
|
||||
|
@ -16,9 +15,8 @@ final class CleanupHistoryTask extends AbstractTask
|
|||
private readonly Entity\Repository\StationQueueRepository $queueRepo,
|
||||
private readonly Entity\Repository\ListenerRepository $listenerRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -6,16 +6,14 @@ namespace App\Sync\Task;
|
|||
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class CleanupLoginTokensTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Entity\Repository\UserLoginTokenRepository $loginTokenRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -8,7 +8,6 @@ use App\Doctrine\ReloadableEntityManagerInterface;
|
|||
use App\Entity;
|
||||
use Exception;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Throwable;
|
||||
|
||||
|
@ -17,9 +16,8 @@ final class CleanupStorageTask extends AbstractTask
|
|||
public function __construct(
|
||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -9,17 +9,15 @@ use App\Radio\Adapters;
|
|||
use App\Radio\AutoDJ\Scheduler;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Radio\Enums\BackendAdapters;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class EnforceBroadcastTimesTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
private readonly Scheduler $scheduler,
|
||||
private readonly Adapters $adapters,
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -6,7 +6,6 @@ namespace App\Sync\Task;
|
|||
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Throwable;
|
||||
|
||||
|
@ -18,12 +17,11 @@ final class MoveBroadcastsTask extends AbstractTask
|
|||
}
|
||||
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
private readonly Entity\Repository\StationStreamerBroadcastRepository $broadcastRepo,
|
||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public function run(bool $force = false): void
|
||||
|
|
|
@ -11,7 +11,6 @@ use App\Radio\Adapters;
|
|||
use App\Radio\AutoDJ\Queue;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Radio\Enums\LiquidsoapQueues;
|
||||
use Monolog\Logger;
|
||||
use Monolog\LogRecord;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
|
@ -21,10 +20,9 @@ final class QueueInterruptingTracks extends AbstractTask
|
|||
private readonly Queue $queue,
|
||||
private readonly Adapters $adapters,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly Logger $monolog,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
) {
|
||||
parent::__construct($em, $monolog);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
@ -40,7 +38,7 @@ final class QueueInterruptingTracks extends AbstractTask
|
|||
public function run(bool $force = false): void
|
||||
{
|
||||
foreach ($this->iterateStations() as $station) {
|
||||
$this->monolog->pushProcessor(
|
||||
$this->logger->pushProcessor(
|
||||
function (LogRecord $record) use ($station) {
|
||||
$record->extra['station'] = [
|
||||
'id' => $station->getId(),
|
||||
|
@ -53,7 +51,7 @@ final class QueueInterruptingTracks extends AbstractTask
|
|||
try {
|
||||
$this->queueForStation($station);
|
||||
} finally {
|
||||
$this->monolog->popProcessor();
|
||||
$this->logger->popProcessor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,14 @@ namespace App\Sync\Task;
|
|||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Service\Acme;
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class RenewAcmeCertTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
private readonly Acme $acme
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Entity;
|
|||
use App\Nginx\ConfigWriter;
|
||||
use App\Nginx\Nginx;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Throwable;
|
||||
|
@ -17,13 +16,12 @@ use Throwable;
|
|||
final class RotateLogsTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo,
|
||||
private readonly Nginx $nginx,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace App\Sync\Task;
|
|||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Entity;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class RunAnalyticsTask extends AbstractTask
|
||||
{
|
||||
|
@ -17,9 +16,8 @@ final class RunAnalyticsTask extends AbstractTask
|
|||
private readonly Entity\Repository\ListenerRepository $listenerRepo,
|
||||
private readonly Entity\Repository\SongHistoryRepository $historyRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -10,7 +10,6 @@ use App\Entity;
|
|||
use App\Message;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Carbon\CarbonInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Messenger\MessageBus;
|
||||
|
||||
final class RunBackupTask extends AbstractTask
|
||||
|
@ -20,9 +19,8 @@ final class RunBackupTask extends AbstractTask
|
|||
private readonly Application $console,
|
||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -6,16 +6,14 @@ namespace App\Sync\Task;
|
|||
|
||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||
use App\Service\Centrifugo;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class SendTimeOnSocketTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
private readonly Centrifugo $centrifugo,
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -10,7 +10,6 @@ use App\Service\IpGeolocator\GeoLite;
|
|||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
|
@ -21,10 +20,9 @@ final class UpdateGeoLiteTask extends AbstractTask
|
|||
public function __construct(
|
||||
private readonly Client $httpClient,
|
||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -12,16 +12,14 @@ use Brick\Math\BigInteger;
|
|||
use Exception;
|
||||
use League\Flysystem\FileAttributes;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class UpdateStorageLocationSizesTask extends AbstractTask
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo,
|
||||
ReloadableEntityManagerInterface $em,
|
||||
LoggerInterface $logger
|
||||
ReloadableEntityManagerInterface $em
|
||||
) {
|
||||
parent::__construct($em, $logger);
|
||||
parent::__construct($em);
|
||||
}
|
||||
|
||||
public static function getSchedulePattern(): string
|
||||
|
|
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Webhook\Connector;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Utilities;
|
||||
use GuzzleHttp\Client;
|
||||
use Monolog\Logger;
|
||||
use PhpIP\IP;
|
||||
|
||||
abstract class AbstractConnector implements ConnectorInterface
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
protected Logger $logger,
|
||||
protected Client $httpClient
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -9,16 +9,14 @@ use App\Entity\Repository\ListenerRepository;
|
|||
use App\Entity\Station;
|
||||
use App\Nginx\CustomUrls;
|
||||
use GuzzleHttp\Client;
|
||||
use Monolog\Logger;
|
||||
|
||||
abstract class AbstractGoogleAnalyticsConnector extends AbstractConnector
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
Client $httpClient,
|
||||
protected readonly ListenerRepository $listenerRepo
|
||||
) {
|
||||
parent::__construct($logger, $httpClient);
|
||||
parent::__construct($httpClient);
|
||||
}
|
||||
|
||||
protected function webhookShouldTrigger(Entity\StationWebhook $webhook, array $triggers = []): bool
|
||||
|
|
|
@ -9,16 +9,14 @@ use App\Entity\Station;
|
|||
use App\Entity\StationWebhook;
|
||||
use App\Service\Mail;
|
||||
use GuzzleHttp\Client;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class Email extends AbstractConnector
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
Client $httpClient,
|
||||
private readonly Mail $mail
|
||||
) {
|
||||
parent::__construct($logger, $httpClient);
|
||||
parent::__construct($httpClient);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,18 +12,16 @@ use App\Entity\StationWebhook;
|
|||
use App\Http\RouterInterface;
|
||||
use App\Utilities\Urls;
|
||||
use GuzzleHttp\Client;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
final class MatomoAnalytics extends AbstractConnector
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
Client $httpClient,
|
||||
private readonly RouterInterface $router,
|
||||
private readonly ListenerRepository $listenerRepo
|
||||
) {
|
||||
parent::__construct($logger, $httpClient);
|
||||
parent::__construct($httpClient);
|
||||
}
|
||||
|
||||
protected function webhookShouldTrigger(Entity\StationWebhook $webhook, array $triggers = []): bool
|
||||
|
|
|
@ -10,16 +10,14 @@ use App\Entity\StationWebhook;
|
|||
use App\Service\GuzzleFactory;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Subscriber\Oauth\Oauth1;
|
||||
use Monolog\Logger;
|
||||
|
||||
final class Twitter extends AbstractSocialConnector
|
||||
{
|
||||
public function __construct(
|
||||
Logger $logger,
|
||||
Client $httpClient,
|
||||
private readonly GuzzleFactory $guzzleFactory,
|
||||
) {
|
||||
parent::__construct($logger, $httpClient);
|
||||
parent::__construct($httpClient);
|
||||
}
|
||||
|
||||
protected function getRateLimitTime(StationWebhook $webhook): ?int
|
||||
|
|
|
@ -4,30 +4,31 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Webhook;
|
||||
|
||||
use App\Container\ContainerAwareTrait;
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity\ApiGenerator\NowPlayingApiGenerator;
|
||||
use App\Webhook\Connector\AbstractConnector;
|
||||
use App\Webhook\Enums\WebhookTriggers;
|
||||
use App\Entity\Station;
|
||||
use App\Entity\StationWebhook;
|
||||
use App\Environment;
|
||||
use App\Http\RouterInterface;
|
||||
use App\Message;
|
||||
use App\Webhook\Connector\AbstractConnector;
|
||||
use App\Webhook\Enums\WebhookTriggers;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
final class Dispatcher
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
use ContainerAwareTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly Environment $environment,
|
||||
private readonly Logger $logger,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly RouterInterface $router,
|
||||
private readonly LocalWebhookHandler $localHandler,
|
||||
private readonly NowPlayingApiGenerator $nowPlayingApiGen,
|
||||
private readonly ContainerInterface $di
|
||||
private readonly NowPlayingApiGenerator $nowPlayingApiGen
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -4,20 +4,21 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Webhook;
|
||||
|
||||
use App\Container\LoggerAwareTrait;
|
||||
use App\Entity;
|
||||
use App\Environment;
|
||||
use App\Service\Centrifugo;
|
||||
use Monolog\Logger;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
use const JSON_PRETTY_PRINT;
|
||||
|
||||
final class LocalWebhookHandler
|
||||
{
|
||||
use LoggerAwareTrait;
|
||||
|
||||
public const NAME = 'local';
|
||||
|
||||
public function __construct(
|
||||
private readonly Logger $logger,
|
||||
private readonly Environment $environment,
|
||||
private readonly Centrifugo $centrifugo
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue