diff --git a/module/Rest/config/dependencies.config.php b/module/Rest/config/dependencies.config.php index d067d739..bd347897 100644 --- a/module/Rest/config/dependencies.config.php +++ b/module/Rest/config/dependencies.config.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest; use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory; use Laminas\ServiceManager\Factory\InvokableFactory; use Mezzio\Router\Middleware\ImplicitOptionsMiddleware; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Common\Mercure\LcobucciJwtProvider; use Shlinkio\Shlink\Core\Options\AppOptions; use Shlinkio\Shlink\Core\Service; @@ -48,37 +47,28 @@ return [ ConfigAbstractFactory::class => [ ApiKeyService::class => ['em'], - Action\HealthAction::class => ['em', AppOptions::class, 'Logger_Shlink'], - Action\MercureInfoAction::class => [LcobucciJwtProvider::class, 'config.mercure', 'Logger_Shlink'], - Action\ShortUrl\CreateShortUrlAction::class => [ - Service\UrlShortener::class, - 'config.url_shortener.domain', - 'Logger_Shlink', - ], + Action\HealthAction::class => ['em', AppOptions::class], + Action\MercureInfoAction::class => [LcobucciJwtProvider::class, 'config.mercure'], + Action\ShortUrl\CreateShortUrlAction::class => [Service\UrlShortener::class, 'config.url_shortener.domain'], Action\ShortUrl\SingleStepCreateShortUrlAction::class => [ Service\UrlShortener::class, ApiKeyService::class, 'config.url_shortener.domain', - 'Logger_Shlink', ], - Action\ShortUrl\EditShortUrlAction::class => [Service\ShortUrlService::class, 'Logger_Shlink'], - Action\ShortUrl\DeleteShortUrlAction::class => [Service\ShortUrl\DeleteShortUrlService::class, 'Logger_Shlink'], + Action\ShortUrl\EditShortUrlAction::class => [Service\ShortUrlService::class], + Action\ShortUrl\DeleteShortUrlAction::class => [Service\ShortUrl\DeleteShortUrlService::class], Action\ShortUrl\ResolveShortUrlAction::class => [ Service\ShortUrl\ShortUrlResolver::class, 'config.url_shortener.domain', ], - Action\Visit\ShortUrlVisitsAction::class => [Service\VisitsTracker::class, 'Logger_Shlink'], - Action\Visit\GlobalVisitsAction::class => [Visit\VisitsStatsHelper::class, 'Logger_Shlink'], - Action\ShortUrl\ListShortUrlsAction::class => [ - Service\ShortUrlService::class, - 'config.url_shortener.domain', - 'Logger_Shlink', - ], - Action\ShortUrl\EditShortUrlTagsAction::class => [Service\ShortUrlService::class, 'Logger_Shlink'], - Action\Tag\ListTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], - Action\Tag\DeleteTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], - Action\Tag\CreateTagsAction::class => [Service\Tag\TagService::class, LoggerInterface::class], - Action\Tag\UpdateTagAction::class => [Service\Tag\TagService::class, LoggerInterface::class], + Action\Visit\ShortUrlVisitsAction::class => [Service\VisitsTracker::class], + Action\Visit\GlobalVisitsAction::class => [Visit\VisitsStatsHelper::class], + Action\ShortUrl\ListShortUrlsAction::class => [Service\ShortUrlService::class, 'config.url_shortener.domain'], + Action\ShortUrl\EditShortUrlTagsAction::class => [Service\ShortUrlService::class], + Action\Tag\ListTagsAction::class => [Service\Tag\TagService::class], + Action\Tag\DeleteTagsAction::class => [Service\Tag\TagService::class], + Action\Tag\CreateTagsAction::class => [Service\Tag\TagService::class], + Action\Tag\UpdateTagAction::class => [Service\Tag\TagService::class], Middleware\ShortUrl\DropDefaultDomainFromRequestMiddleware::class => ['config.url_shortener.domain.hostname'], Middleware\ShortUrl\DefaultShortCodesLengthMiddleware::class => [ diff --git a/module/Rest/src/Action/AbstractRestAction.php b/module/Rest/src/Action/AbstractRestAction.php index 589e2d0e..da8b6d80 100644 --- a/module/Rest/src/Action/AbstractRestAction.php +++ b/module/Rest/src/Action/AbstractRestAction.php @@ -7,8 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Server\RequestHandlerInterface; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; use function array_merge; @@ -17,13 +15,6 @@ abstract class AbstractRestAction implements RequestHandlerInterface, RequestMet protected const ROUTE_PATH = ''; protected const ROUTE_ALLOWED_METHODS = []; - protected LoggerInterface $logger; - - public function __construct(?LoggerInterface $logger = null) - { - $this->logger = $logger ?? new NullLogger(); - } - public static function getRouteDef(array $prevMiddleware = [], array $postMiddleware = []): array { return [ diff --git a/module/Rest/src/Action/HealthAction.php b/module/Rest/src/Action/HealthAction.php index ef1b6b88..ef89da64 100644 --- a/module/Rest/src/Action/HealthAction.php +++ b/module/Rest/src/Action/HealthAction.php @@ -8,7 +8,6 @@ use Doctrine\ORM\EntityManagerInterface; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Options\AppOptions; use Throwable; @@ -24,9 +23,8 @@ class HealthAction extends AbstractRestAction private EntityManagerInterface $em; private AppOptions $options; - public function __construct(EntityManagerInterface $em, AppOptions $options, ?LoggerInterface $logger = null) + public function __construct(EntityManagerInterface $em, AppOptions $options) { - parent::__construct($logger); $this->em = $em; $this->options = $options; } diff --git a/module/Rest/src/Action/MercureInfoAction.php b/module/Rest/src/Action/MercureInfoAction.php index bad4cb9c..75893ab9 100644 --- a/module/Rest/src/Action/MercureInfoAction.php +++ b/module/Rest/src/Action/MercureInfoAction.php @@ -8,7 +8,6 @@ use Cake\Chronos\Chronos; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Common\Mercure\JwtProviderInterface; use Shlinkio\Shlink\Rest\Exception\MercureException; use Throwable; @@ -23,12 +22,8 @@ class MercureInfoAction extends AbstractRestAction private JwtProviderInterface $jwtProvider; private array $mercureConfig; - public function __construct( - JwtProviderInterface $jwtProvider, - array $mercureConfig, - ?LoggerInterface $logger = null - ) { - parent::__construct($logger); + public function __construct(JwtProviderInterface $jwtProvider, array $mercureConfig) + { $this->jwtProvider = $jwtProvider; $this->mercureConfig = $mercureConfig; } diff --git a/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php index 3335e1fa..feed626d 100644 --- a/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Model\CreateShortUrlData; use Shlinkio\Shlink\Core\Service\UrlShortenerInterface; @@ -19,12 +18,8 @@ abstract class AbstractCreateShortUrlAction extends AbstractRestAction private UrlShortenerInterface $urlShortener; private array $domainConfig; - public function __construct( - UrlShortenerInterface $urlShortener, - array $domainConfig, - ?LoggerInterface $logger = null - ) { - parent::__construct($logger); + public function __construct(UrlShortenerInterface $urlShortener, array $domainConfig) + { $this->urlShortener = $urlShortener; $this->domainConfig = $domainConfig; } diff --git a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php index d86c60e9..bd5b487e 100644 --- a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\EmptyResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -19,9 +18,8 @@ class DeleteShortUrlAction extends AbstractRestAction private DeleteShortUrlServiceInterface $deleteShortUrlService; - public function __construct(DeleteShortUrlServiceInterface $deleteShortUrlService, ?LoggerInterface $logger = null) + public function __construct(DeleteShortUrlServiceInterface $deleteShortUrlService) { - parent::__construct($logger); $this->deleteShortUrlService = $deleteShortUrlService; } diff --git a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php index da7012b6..30d95ae1 100644 --- a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\EmptyResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Model\ShortUrlEdit; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface; @@ -20,9 +19,8 @@ class EditShortUrlAction extends AbstractRestAction private ShortUrlServiceInterface $shortUrlService; - public function __construct(ShortUrlServiceInterface $shortUrlService, ?LoggerInterface $logger = null) + public function __construct(ShortUrlServiceInterface $shortUrlService) { - parent::__construct($logger); $this->shortUrlService = $shortUrlService; } diff --git a/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php b/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php index 0a48d986..def36d6c 100644 --- a/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php +++ b/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface; @@ -20,9 +19,8 @@ class EditShortUrlTagsAction extends AbstractRestAction private ShortUrlServiceInterface $shortUrlService; - public function __construct(ShortUrlServiceInterface $shortUrlService, ?LoggerInterface $logger = null) + public function __construct(ShortUrlServiceInterface $shortUrlService) { - parent::__construct($logger); $this->shortUrlService = $shortUrlService; } diff --git a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php index 5801eeec..10a0effc 100644 --- a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php +++ b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait; use Shlinkio\Shlink\Core\Model\ShortUrlsParams; use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface; @@ -24,12 +23,8 @@ class ListShortUrlsAction extends AbstractRestAction private ShortUrlServiceInterface $shortUrlService; private array $domainConfig; - public function __construct( - ShortUrlServiceInterface $shortUrlService, - array $domainConfig, - ?LoggerInterface $logger = null - ) { - parent::__construct($logger); + public function __construct(ShortUrlServiceInterface $shortUrlService, array $domainConfig) + { $this->shortUrlService = $shortUrlService; $this->domainConfig = $domainConfig; } diff --git a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php index 41cd2b2d..9c2cb3e4 100644 --- a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Service\ShortUrl\ShortUrlResolverInterface; use Shlinkio\Shlink\Core\Transformer\ShortUrlDataTransformer; @@ -21,12 +20,8 @@ class ResolveShortUrlAction extends AbstractRestAction private ShortUrlResolverInterface $urlResolver; private array $domainConfig; - public function __construct( - ShortUrlResolverInterface $urlResolver, - array $domainConfig, - ?LoggerInterface $logger = null - ) { - parent::__construct($logger); + public function __construct(ShortUrlResolverInterface $urlResolver, array $domainConfig) + { $this->urlResolver = $urlResolver; $this->domainConfig = $domainConfig; } diff --git a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php index e754e3ad..daeb3d04 100644 --- a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php @@ -6,7 +6,6 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl; use Laminas\Diactoros\Uri; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Model\CreateShortUrlData; use Shlinkio\Shlink\Core\Service\UrlShortenerInterface; @@ -22,10 +21,9 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction public function __construct( UrlShortenerInterface $urlShortener, ApiKeyServiceInterface $apiKeyService, - array $domainConfig, - ?LoggerInterface $logger = null + array $domainConfig ) { - parent::__construct($urlShortener, $domainConfig, $logger); + parent::__construct($urlShortener, $domainConfig); $this->apiKeyService = $apiKeyService; } diff --git a/module/Rest/src/Action/Tag/CreateTagsAction.php b/module/Rest/src/Action/Tag/CreateTagsAction.php index eb4a279b..c481b463 100644 --- a/module/Rest/src/Action/Tag/CreateTagsAction.php +++ b/module/Rest/src/Action/Tag/CreateTagsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Tag; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -18,9 +17,8 @@ class CreateTagsAction extends AbstractRestAction private TagServiceInterface $tagService; - public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) + public function __construct(TagServiceInterface $tagService) { - parent::__construct($logger); $this->tagService = $tagService; } diff --git a/module/Rest/src/Action/Tag/DeleteTagsAction.php b/module/Rest/src/Action/Tag/DeleteTagsAction.php index b8bedab9..5002eba0 100644 --- a/module/Rest/src/Action/Tag/DeleteTagsAction.php +++ b/module/Rest/src/Action/Tag/DeleteTagsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Tag; use Laminas\Diactoros\Response\EmptyResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -18,9 +17,8 @@ class DeleteTagsAction extends AbstractRestAction private TagServiceInterface $tagService; - public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) + public function __construct(TagServiceInterface $tagService) { - parent::__construct($logger); $this->tagService = $tagService; } diff --git a/module/Rest/src/Action/Tag/ListTagsAction.php b/module/Rest/src/Action/Tag/ListTagsAction.php index 7cc7e063..7211bce6 100644 --- a/module/Rest/src/Action/Tag/ListTagsAction.php +++ b/module/Rest/src/Action/Tag/ListTagsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Tag; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -18,9 +17,8 @@ class ListTagsAction extends AbstractRestAction private TagServiceInterface $tagService; - public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) + public function __construct(TagServiceInterface $tagService) { - parent::__construct($logger); $this->tagService = $tagService; } diff --git a/module/Rest/src/Action/Tag/UpdateTagAction.php b/module/Rest/src/Action/Tag/UpdateTagAction.php index 6fb72e01..de5eb476 100644 --- a/module/Rest/src/Action/Tag/UpdateTagAction.php +++ b/module/Rest/src/Action/Tag/UpdateTagAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Tag; use Laminas\Diactoros\Response\EmptyResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -19,9 +18,8 @@ class UpdateTagAction extends AbstractRestAction private TagServiceInterface $tagService; - public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) + public function __construct(TagServiceInterface $tagService) { - parent::__construct($logger); $this->tagService = $tagService; } diff --git a/module/Rest/src/Action/Visit/GlobalVisitsAction.php b/module/Rest/src/Action/Visit/GlobalVisitsAction.php index 1946e222..a27412b2 100644 --- a/module/Rest/src/Action/Visit/GlobalVisitsAction.php +++ b/module/Rest/src/Action/Visit/GlobalVisitsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Visit; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Visit\VisitsStatsHelperInterface; use Shlinkio\Shlink\Rest\Action\AbstractRestAction; @@ -18,9 +17,8 @@ class GlobalVisitsAction extends AbstractRestAction private VisitsStatsHelperInterface $statsHelper; - public function __construct(VisitsStatsHelperInterface $statsHelper, ?LoggerInterface $logger = null) + public function __construct(VisitsStatsHelperInterface $statsHelper) { - parent::__construct($logger); $this->statsHelper = $statsHelper; } diff --git a/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php b/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php index f7f0224a..92a7e873 100644 --- a/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php +++ b/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php @@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Action\Visit; use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Model\VisitsParams; @@ -23,9 +22,8 @@ class ShortUrlVisitsAction extends AbstractRestAction private VisitsTrackerInterface $visitsTracker; - public function __construct(VisitsTrackerInterface $visitsTracker, ?LoggerInterface $logger = null) + public function __construct(VisitsTrackerInterface $visitsTracker) { - parent::__construct($logger); $this->visitsTracker = $visitsTracker; }