2016-07-19 18:07:59 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
2017-07-22 15:20:40 +03:00
|
|
|
|
2018-09-20 21:27:34 +03:00
|
|
|
namespace Shlinkio\Shlink\Rest;
|
|
|
|
|
2020-01-01 23:11:53 +03:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
|
|
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
2022-02-20 12:36:54 +03:00
|
|
|
use Mezzio\ProblemDetails\ProblemDetailsResponseFactory;
|
2020-01-01 23:11:53 +03:00
|
|
|
use Mezzio\Router\Middleware\ImplicitOptionsMiddleware;
|
2022-02-20 12:36:54 +03:00
|
|
|
use Psr\Log\LoggerInterface;
|
2020-04-12 14:59:10 +03:00
|
|
|
use Shlinkio\Shlink\Common\Mercure\LcobucciJwtProvider;
|
2020-09-27 10:53:12 +03:00
|
|
|
use Shlinkio\Shlink\Core\Domain\DomainService;
|
2021-12-09 14:11:09 +03:00
|
|
|
use Shlinkio\Shlink\Core\Options;
|
2022-09-23 19:42:38 +03:00
|
|
|
use Shlinkio\Shlink\Core\ShortUrl;
|
2021-02-02 00:55:52 +03:00
|
|
|
use Shlinkio\Shlink\Core\ShortUrl\Transformer\ShortUrlDataTransformer;
|
2020-05-08 11:29:24 +03:00
|
|
|
use Shlinkio\Shlink\Core\Tag\TagService;
|
2020-05-01 12:40:02 +03:00
|
|
|
use Shlinkio\Shlink\Core\Visit;
|
2017-07-22 15:20:40 +03:00
|
|
|
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
2016-07-19 18:07:59 +03:00
|
|
|
|
|
|
|
return [
|
|
|
|
|
2016-07-31 17:30:05 +03:00
|
|
|
'dependencies' => [
|
2016-07-19 18:07:59 +03:00
|
|
|
'factories' => [
|
2017-07-22 15:20:40 +03:00
|
|
|
ApiKeyService::class => ConfigAbstractFactory::class,
|
|
|
|
|
2019-11-20 22:18:21 +03:00
|
|
|
Action\HealthAction::class => ConfigAbstractFactory::class,
|
2020-04-12 15:19:51 +03:00
|
|
|
Action\MercureInfoAction::class => ConfigAbstractFactory::class,
|
2018-09-20 20:55:24 +03:00
|
|
|
Action\ShortUrl\CreateShortUrlAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\ShortUrl\SingleStepCreateShortUrlAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\ShortUrl\EditShortUrlAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\ShortUrl\DeleteShortUrlAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\ShortUrl\ResolveShortUrlAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\ShortUrl\ListShortUrlsAction::class => ConfigAbstractFactory::class,
|
2020-05-01 12:17:07 +03:00
|
|
|
Action\Visit\ShortUrlVisitsAction::class => ConfigAbstractFactory::class,
|
2020-05-09 10:53:45 +03:00
|
|
|
Action\Visit\TagVisitsAction::class => ConfigAbstractFactory::class,
|
2022-04-23 11:32:07 +03:00
|
|
|
Action\Visit\DomainVisitsAction::class => ConfigAbstractFactory::class,
|
2020-05-01 12:40:02 +03:00
|
|
|
Action\Visit\GlobalVisitsAction::class => ConfigAbstractFactory::class,
|
2021-02-10 00:11:09 +03:00
|
|
|
Action\Visit\OrphanVisitsAction::class => ConfigAbstractFactory::class,
|
2022-01-16 14:24:02 +03:00
|
|
|
Action\Visit\NonOrphanVisitsAction::class => ConfigAbstractFactory::class,
|
2017-07-22 15:20:40 +03:00
|
|
|
Action\Tag\ListTagsAction::class => ConfigAbstractFactory::class,
|
2022-01-09 19:24:07 +03:00
|
|
|
Action\Tag\TagsStatsAction::class => ConfigAbstractFactory::class,
|
2017-07-22 15:20:40 +03:00
|
|
|
Action\Tag\DeleteTagsAction::class => ConfigAbstractFactory::class,
|
|
|
|
Action\Tag\UpdateTagAction::class => ConfigAbstractFactory::class,
|
2020-09-27 10:53:12 +03:00
|
|
|
Action\Domain\ListDomainsAction::class => ConfigAbstractFactory::class,
|
2021-07-30 19:53:57 +03:00
|
|
|
Action\Domain\DomainRedirectsAction::class => ConfigAbstractFactory::class,
|
2017-07-22 15:20:40 +03:00
|
|
|
|
2019-08-11 15:02:25 +03:00
|
|
|
ImplicitOptionsMiddleware::class => Middleware\EmptyResponseImplicitOptionsMiddlewareFactory::class,
|
2017-07-22 15:20:40 +03:00
|
|
|
Middleware\BodyParserMiddleware::class => InvokableFactory::class,
|
2020-12-31 15:28:06 +03:00
|
|
|
Middleware\CrossDomainMiddleware::class => ConfigAbstractFactory::class,
|
2018-09-20 21:00:53 +03:00
|
|
|
Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware::class => InvokableFactory::class,
|
2020-02-08 14:22:07 +03:00
|
|
|
Middleware\ShortUrl\DropDefaultDomainFromRequestMiddleware::class => ConfigAbstractFactory::class,
|
2020-02-18 21:21:34 +03:00
|
|
|
Middleware\ShortUrl\DefaultShortCodesLengthMiddleware::class => ConfigAbstractFactory::class,
|
2021-01-04 22:15:42 +03:00
|
|
|
Middleware\ShortUrl\OverrideDomainMiddleware::class => ConfigAbstractFactory::class,
|
2022-02-20 12:36:54 +03:00
|
|
|
Middleware\Mercure\NotConfiguredMercureErrorHandler::class => ConfigAbstractFactory::class,
|
2022-08-13 17:50:19 +03:00
|
|
|
Middleware\ErrorHandler\BackwardsCompatibleProblemDetailsHandler::class => InvokableFactory::class,
|
2017-07-22 15:20:40 +03:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
ConfigAbstractFactory::class => [
|
|
|
|
ApiKeyService::class => ['em'],
|
|
|
|
|
2021-12-09 14:11:09 +03:00
|
|
|
Action\HealthAction::class => ['em', Options\AppOptions::class],
|
2020-05-01 13:08:44 +03:00
|
|
|
Action\MercureInfoAction::class => [LcobucciJwtProvider::class, 'config.mercure'],
|
2022-08-05 09:38:05 +03:00
|
|
|
Action\ShortUrl\CreateShortUrlAction::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\UrlShortener::class,
|
2022-08-05 09:38:05 +03:00
|
|
|
ShortUrlDataTransformer::class,
|
|
|
|
Options\UrlShortenerOptions::class,
|
|
|
|
],
|
2018-09-20 20:55:24 +03:00
|
|
|
Action\ShortUrl\SingleStepCreateShortUrlAction::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\UrlShortener::class,
|
2021-02-02 00:55:52 +03:00
|
|
|
ShortUrlDataTransformer::class,
|
2022-08-05 09:38:05 +03:00
|
|
|
Options\UrlShortenerOptions::class,
|
2018-05-03 14:21:43 +03:00
|
|
|
],
|
2022-09-23 19:42:38 +03:00
|
|
|
Action\ShortUrl\EditShortUrlAction::class => [ShortUrl\ShortUrlService::class, ShortUrlDataTransformer::class],
|
|
|
|
Action\ShortUrl\DeleteShortUrlAction::class => [ShortUrl\DeleteShortUrlService::class],
|
2020-01-26 21:21:51 +03:00
|
|
|
Action\ShortUrl\ResolveShortUrlAction::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-02-02 00:55:52 +03:00
|
|
|
ShortUrlDataTransformer::class,
|
2020-01-26 21:21:51 +03:00
|
|
|
],
|
2021-02-08 21:46:51 +03:00
|
|
|
Action\Visit\ShortUrlVisitsAction::class => [Visit\VisitsStatsHelper::class],
|
|
|
|
Action\Visit\TagVisitsAction::class => [Visit\VisitsStatsHelper::class],
|
2022-04-23 11:32:07 +03:00
|
|
|
Action\Visit\DomainVisitsAction::class => [
|
|
|
|
Visit\VisitsStatsHelper::class,
|
|
|
|
'config.url_shortener.domain.hostname',
|
|
|
|
],
|
2020-05-01 13:08:44 +03:00
|
|
|
Action\Visit\GlobalVisitsAction::class => [Visit\VisitsStatsHelper::class],
|
2021-02-10 00:11:09 +03:00
|
|
|
Action\Visit\OrphanVisitsAction::class => [
|
|
|
|
Visit\VisitsStatsHelper::class,
|
|
|
|
Visit\Transformer\OrphanVisitDataTransformer::class,
|
|
|
|
],
|
2022-01-16 14:24:02 +03:00
|
|
|
Action\Visit\NonOrphanVisitsAction::class => [Visit\VisitsStatsHelper::class],
|
2022-09-23 19:42:38 +03:00
|
|
|
Action\ShortUrl\ListShortUrlsAction::class => [ShortUrl\ShortUrlService::class, ShortUrlDataTransformer::class],
|
2020-05-08 11:29:24 +03:00
|
|
|
Action\Tag\ListTagsAction::class => [TagService::class],
|
2022-01-09 19:24:07 +03:00
|
|
|
Action\Tag\TagsStatsAction::class => [TagService::class],
|
2020-05-08 11:29:24 +03:00
|
|
|
Action\Tag\DeleteTagsAction::class => [TagService::class],
|
|
|
|
Action\Tag\UpdateTagAction::class => [TagService::class],
|
2021-12-09 14:11:09 +03:00
|
|
|
Action\Domain\ListDomainsAction::class => [DomainService::class, Options\NotFoundRedirectOptions::class],
|
2021-07-30 19:53:57 +03:00
|
|
|
Action\Domain\DomainRedirectsAction::class => [DomainService::class],
|
2020-02-02 21:03:43 +03:00
|
|
|
|
2020-12-31 15:28:06 +03:00
|
|
|
Middleware\CrossDomainMiddleware::class => ['config.cors'],
|
2020-02-08 14:22:07 +03:00
|
|
|
Middleware\ShortUrl\DropDefaultDomainFromRequestMiddleware::class => ['config.url_shortener.domain.hostname'],
|
2020-02-18 21:21:34 +03:00
|
|
|
Middleware\ShortUrl\DefaultShortCodesLengthMiddleware::class => [
|
|
|
|
'config.url_shortener.default_short_codes_length',
|
|
|
|
],
|
2021-01-04 22:15:42 +03:00
|
|
|
Middleware\ShortUrl\OverrideDomainMiddleware::class => [DomainService::class],
|
2022-02-20 12:36:54 +03:00
|
|
|
Middleware\Mercure\NotConfiguredMercureErrorHandler::class => [
|
|
|
|
ProblemDetailsResponseFactory::class,
|
|
|
|
LoggerInterface::class,
|
|
|
|
],
|
2016-07-19 18:07:59 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|