2016-07-19 19:01:39 +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 14:48:30 +03:00
|
|
|
|
2018-12-01 23:38:29 +03:00
|
|
|
namespace Shlinkio\Shlink\Core;
|
|
|
|
|
2020-01-01 23:11:53 +03:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
2020-11-22 20:03:27 +03:00
|
|
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
2019-07-13 13:04:21 +03:00
|
|
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
2022-09-17 13:57:04 +03:00
|
|
|
use Shlinkio\Shlink\Config\Factory\ValinorConfigFactory;
|
2019-11-23 12:25:12 +03:00
|
|
|
use Shlinkio\Shlink\Core\ErrorHandler;
|
2019-11-02 20:33:26 +03:00
|
|
|
use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions;
|
2020-10-22 19:12:22 +03:00
|
|
|
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
|
2022-09-18 19:44:01 +03:00
|
|
|
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
|
2016-07-19 19:01:39 +03:00
|
|
|
|
|
|
|
return [
|
|
|
|
|
2016-07-31 17:30:05 +03:00
|
|
|
'dependencies' => [
|
2016-07-19 19:01:39 +03:00
|
|
|
'factories' => [
|
2021-02-08 23:38:19 +03:00
|
|
|
ErrorHandler\NotFoundTypeResolverMiddleware::class => ConfigAbstractFactory::class,
|
|
|
|
ErrorHandler\NotFoundTrackerMiddleware::class => ConfigAbstractFactory::class,
|
2019-11-23 12:25:12 +03:00
|
|
|
ErrorHandler\NotFoundRedirectHandler::class => ConfigAbstractFactory::class,
|
2020-11-22 20:03:27 +03:00
|
|
|
ErrorHandler\NotFoundTemplateHandler::class => InvokableFactory::class,
|
2018-12-01 23:38:29 +03:00
|
|
|
|
2022-09-17 14:01:28 +03:00
|
|
|
Options\AppOptions::class => [ValinorConfigFactory::class, 'config.app_options'],
|
2022-09-17 14:04:49 +03:00
|
|
|
Options\DeleteShortUrlsOptions::class => [ValinorConfigFactory::class, 'config.delete_short_urls'],
|
2022-09-17 14:32:40 +03:00
|
|
|
Options\NotFoundRedirectOptions::class => [ValinorConfigFactory::class, 'config.not_found_redirects'],
|
2022-09-17 16:36:40 +03:00
|
|
|
Options\RedirectOptions::class => [ValinorConfigFactory::class, 'config.redirects'],
|
2022-09-17 16:54:43 +03:00
|
|
|
Options\UrlShortenerOptions::class => [ValinorConfigFactory::class, 'config.url_shortener'],
|
2022-09-17 13:57:04 +03:00
|
|
|
Options\TrackingOptions::class => [ValinorConfigFactory::class, 'config.tracking'],
|
2022-09-17 14:45:09 +03:00
|
|
|
Options\QrCodeOptions::class => [ValinorConfigFactory::class, 'config.qr_codes'],
|
2022-09-17 14:56:59 +03:00
|
|
|
Options\RabbitMqOptions::class => [ValinorConfigFactory::class, 'config.rabbitmq'],
|
2021-10-09 11:53:21 +03:00
|
|
|
Options\WebhookOptions::class => ConfigAbstractFactory::class,
|
2016-08-07 15:44:33 +03:00
|
|
|
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\UrlShortener::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\ShortUrlService::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\DeleteShortUrlService::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\ShortUrlResolver::class => ConfigAbstractFactory::class,
|
2022-09-23 19:46:51 +03:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class => ConfigAbstractFactory::class,
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class => ConfigAbstractFactory::class,
|
|
|
|
ShortUrl\Middleware\ExtraPathRedirectMiddleware::class => ConfigAbstractFactory::class,
|
2022-09-30 18:19:07 +03:00
|
|
|
ShortUrl\Middleware\TrimTrailingSlashMiddleware::class => ConfigAbstractFactory::class,
|
2021-02-10 00:11:09 +03:00
|
|
|
|
|
|
|
Tag\TagService::class => ConfigAbstractFactory::class,
|
|
|
|
|
2020-09-27 10:53:12 +03:00
|
|
|
Domain\DomainService::class => ConfigAbstractFactory::class,
|
2016-07-19 19:01:39 +03:00
|
|
|
|
2021-02-10 00:11:09 +03:00
|
|
|
Visit\VisitsTracker::class => ConfigAbstractFactory::class,
|
2021-07-15 18:23:09 +03:00
|
|
|
Visit\RequestTracker::class => ConfigAbstractFactory::class,
|
2022-09-23 15:50:26 +03:00
|
|
|
Visit\Geolocation\VisitLocator::class => ConfigAbstractFactory::class,
|
|
|
|
Visit\Geolocation\VisitToLocationHelper::class => ConfigAbstractFactory::class,
|
2021-02-10 00:11:09 +03:00
|
|
|
Visit\VisitsStatsHelper::class => ConfigAbstractFactory::class,
|
|
|
|
Visit\Transformer\OrphanVisitDataTransformer::class => InvokableFactory::class,
|
|
|
|
|
2019-11-16 12:06:55 +03:00
|
|
|
Util\UrlValidator::class => ConfigAbstractFactory::class,
|
2020-10-25 15:20:34 +03:00
|
|
|
Util\DoctrineBatchHelper::class => ConfigAbstractFactory::class,
|
2020-11-10 20:08:25 +03:00
|
|
|
Util\RedirectResponseHelper::class => ConfigAbstractFactory::class,
|
2019-11-16 12:06:55 +03:00
|
|
|
|
2021-07-21 10:28:21 +03:00
|
|
|
Config\NotFoundRedirectResolver::class => ConfigAbstractFactory::class,
|
|
|
|
|
2017-07-22 14:48:30 +03:00
|
|
|
Action\RedirectAction::class => ConfigAbstractFactory::class,
|
2018-03-26 21:13:03 +03:00
|
|
|
Action\PixelAction::class => ConfigAbstractFactory::class,
|
2017-07-22 14:48:30 +03:00
|
|
|
Action\QrCodeAction::class => ConfigAbstractFactory::class,
|
2021-05-22 08:15:34 +03:00
|
|
|
Action\RobotsAction::class => ConfigAbstractFactory::class,
|
2018-12-01 23:38:29 +03:00
|
|
|
|
2022-07-27 10:38:47 +03:00
|
|
|
EventDispatcher\PublishingUpdatesGenerator::class => ConfigAbstractFactory::class,
|
2020-10-22 19:12:22 +03:00
|
|
|
|
|
|
|
Importer\ImportedLinksProcessor::class => ConfigAbstractFactory::class,
|
2021-05-22 08:15:34 +03:00
|
|
|
|
2021-05-22 10:34:42 +03:00
|
|
|
Crawling\CrawlingHelper::class => ConfigAbstractFactory::class,
|
2020-10-22 19:12:22 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
'aliases' => [
|
|
|
|
ImportedLinksProcessorInterface::class => Importer\ImportedLinksProcessor::class,
|
2016-07-19 19:01:39 +03:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2017-07-22 14:48:30 +03:00
|
|
|
ConfigAbstractFactory::class => [
|
2021-02-08 23:38:19 +03:00
|
|
|
ErrorHandler\NotFoundTypeResolverMiddleware::class => ['config.router.base_path'],
|
2021-07-15 18:23:09 +03:00
|
|
|
ErrorHandler\NotFoundTrackerMiddleware::class => [Visit\RequestTracker::class],
|
2020-11-10 20:08:25 +03:00
|
|
|
ErrorHandler\NotFoundRedirectHandler::class => [
|
|
|
|
NotFoundRedirectOptions::class,
|
2021-07-21 10:28:21 +03:00
|
|
|
Config\NotFoundRedirectResolver::class,
|
|
|
|
Domain\DomainService::class,
|
2020-11-10 20:08:25 +03:00
|
|
|
],
|
2017-10-13 12:55:14 +03:00
|
|
|
|
2022-01-16 17:34:07 +03:00
|
|
|
Options\WebhookOptions::class => ['config.visits_webhooks'],
|
2018-11-03 13:37:43 +03:00
|
|
|
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\UrlShortener::class => [
|
2021-02-05 19:59:34 +03:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class,
|
2020-10-25 13:16:42 +03:00
|
|
|
'em',
|
2020-11-07 11:31:46 +03:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
2022-09-23 19:46:51 +03:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class,
|
2022-07-24 12:07:20 +03:00
|
|
|
EventDispatcherInterface::class,
|
2020-10-25 13:16:42 +03:00
|
|
|
],
|
2021-02-08 21:50:17 +03:00
|
|
|
Visit\VisitsTracker::class => [
|
2020-05-08 14:10:58 +03:00
|
|
|
'em',
|
|
|
|
EventDispatcherInterface::class,
|
2021-05-16 10:30:04 +03:00
|
|
|
Options\TrackingOptions::class,
|
2020-05-08 14:10:58 +03:00
|
|
|
],
|
2021-07-15 18:23:09 +03:00
|
|
|
Visit\RequestTracker::class => [Visit\VisitsTracker::class, Options\TrackingOptions::class],
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlService::class => [
|
2021-01-31 14:12:21 +03:00
|
|
|
'em',
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-02-05 19:59:34 +03:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class,
|
2021-01-31 14:12:21 +03:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
|
|
|
],
|
2022-09-23 15:50:26 +03:00
|
|
|
Visit\Geolocation\VisitLocator::class => ['em'],
|
|
|
|
Visit\Geolocation\VisitToLocationHelper::class => [IpLocationResolverInterface::class],
|
2020-05-01 12:40:02 +03:00
|
|
|
Visit\VisitsStatsHelper::class => ['em'],
|
2020-05-08 11:15:33 +03:00
|
|
|
Tag\TagService::class => ['em'],
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\DeleteShortUrlService::class => [
|
2020-02-02 00:54:02 +03:00
|
|
|
'em',
|
|
|
|
Options\DeleteShortUrlsOptions::class,
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2020-02-02 00:54:02 +03:00
|
|
|
],
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class => ['em'],
|
2022-09-23 19:46:51 +03:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class => ['em'],
|
2021-12-09 14:32:02 +03:00
|
|
|
Domain\DomainService::class => ['em', 'config.url_shortener.domain.hostname'],
|
2017-07-22 14:48:30 +03:00
|
|
|
|
2020-03-22 18:58:28 +03:00
|
|
|
Util\UrlValidator::class => ['httpClient', Options\UrlShortenerOptions::class],
|
2020-10-25 15:20:34 +03:00
|
|
|
Util\DoctrineBatchHelper::class => ['em'],
|
2022-01-16 17:34:07 +03:00
|
|
|
Util\RedirectResponseHelper::class => [Options\RedirectOptions::class],
|
2019-11-16 12:06:55 +03:00
|
|
|
|
2021-10-03 17:45:13 +03:00
|
|
|
Config\NotFoundRedirectResolver::class => [Util\RedirectResponseHelper::class, 'Logger_Shlink'],
|
2021-07-21 10:28:21 +03:00
|
|
|
|
2018-01-14 11:24:33 +03:00
|
|
|
Action\RedirectAction::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-07-15 18:23:09 +03:00
|
|
|
Visit\RequestTracker::class,
|
2021-07-15 14:28:31 +03:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class,
|
2020-11-10 20:08:25 +03:00
|
|
|
Util\RedirectResponseHelper::class,
|
2018-01-14 11:24:33 +03:00
|
|
|
],
|
2022-09-23 19:42:38 +03:00
|
|
|
Action\PixelAction::class => [ShortUrl\ShortUrlResolver::class, Visit\RequestTracker::class],
|
2020-01-26 21:21:51 +03:00
|
|
|
Action\QrCodeAction::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-02-02 00:55:52 +03:00
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class,
|
2020-01-26 21:21:51 +03:00
|
|
|
'Logger_Shlink',
|
2021-09-26 14:25:02 +03:00
|
|
|
Options\QrCodeOptions::class,
|
2020-01-26 21:21:51 +03:00
|
|
|
],
|
2021-05-22 08:15:34 +03:00
|
|
|
Action\RobotsAction::class => [Crawling\CrawlingHelper::class],
|
2018-12-01 23:38:29 +03:00
|
|
|
|
2020-11-07 11:31:46 +03:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => ['em'],
|
2021-02-02 01:18:19 +03:00
|
|
|
ShortUrl\Helper\ShortUrlStringifier::class => ['config.url_shortener.domain', 'config.router.base_path'],
|
2021-02-05 19:59:34 +03:00
|
|
|
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class => [Util\UrlValidator::class],
|
2021-07-14 17:36:03 +03:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class => [Options\TrackingOptions::class],
|
2021-02-02 00:55:52 +03:00
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class => [ShortUrl\Helper\ShortUrlStringifier::class],
|
2021-07-15 17:54:54 +03:00
|
|
|
ShortUrl\Middleware\ExtraPathRedirectMiddleware::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2021-07-15 18:23:09 +03:00
|
|
|
Visit\RequestTracker::class,
|
2021-07-15 17:54:54 +03:00
|
|
|
ShortUrl\Helper\ShortUrlRedirectionBuilder::class,
|
|
|
|
Util\RedirectResponseHelper::class,
|
|
|
|
Options\UrlShortenerOptions::class,
|
|
|
|
],
|
2022-09-30 18:19:07 +03:00
|
|
|
ShortUrl\Middleware\TrimTrailingSlashMiddleware::class => [Options\UrlShortenerOptions::class],
|
2020-04-12 18:05:59 +03:00
|
|
|
|
2022-07-27 10:38:47 +03:00
|
|
|
EventDispatcher\PublishingUpdatesGenerator::class => [
|
2021-02-12 00:12:38 +03:00
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class,
|
|
|
|
Visit\Transformer\OrphanVisitDataTransformer::class,
|
|
|
|
],
|
2020-10-22 19:12:22 +03:00
|
|
|
|
2020-10-25 13:16:42 +03:00
|
|
|
Importer\ImportedLinksProcessor::class => [
|
|
|
|
'em',
|
2020-11-07 11:31:46 +03:00
|
|
|
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
2022-09-23 19:46:51 +03:00
|
|
|
ShortUrl\Helper\ShortCodeUniquenessHelper::class,
|
2020-10-25 15:20:34 +03:00
|
|
|
Util\DoctrineBatchHelper::class,
|
2020-10-25 13:16:42 +03:00
|
|
|
],
|
2021-05-22 10:34:42 +03:00
|
|
|
|
|
|
|
Crawling\CrawlingHelper::class => ['em'],
|
2017-07-22 14:48:30 +03:00
|
|
|
],
|
|
|
|
|
2016-07-19 19:01:39 +03:00
|
|
|
];
|