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