shlink/module/Core/config/dependencies.config.php

49 lines
2 KiB
PHP
Raw Normal View History

2016-07-19 19:01:39 +03:00
<?php
use Doctrine\Common\Cache\Cache;
use Shlinkio\Shlink\Common\Service\PreviewGenerator;
2016-08-09 11:24:42 +03:00
use Shlinkio\Shlink\Core\Action;
use Shlinkio\Shlink\Core\Middleware;
use Shlinkio\Shlink\Core\Options;
2016-07-19 19:01:39 +03:00
use Shlinkio\Shlink\Core\Service;
use Zend\Expressive\Router\RouterInterface;
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
2016-07-19 19:01:39 +03:00
return [
'dependencies' => [
2016-07-19 19:01:39 +03:00
'factories' => [
Options\AppOptions::class => Options\AppOptionsFactory::class,
2016-08-07 15:44:33 +03:00
2016-07-19 19:01:39 +03:00
// Services
Service\UrlShortener::class => ConfigAbstractFactory::class,
Service\VisitsTracker::class => ConfigAbstractFactory::class,
Service\ShortUrlService::class => ConfigAbstractFactory::class,
Service\VisitService::class => ConfigAbstractFactory::class,
Service\Tag\TagService::class => ConfigAbstractFactory::class,
2016-07-19 19:01:39 +03:00
// Middleware
Action\RedirectAction::class => ConfigAbstractFactory::class,
Action\QrCodeAction::class => ConfigAbstractFactory::class,
Action\PreviewAction::class => ConfigAbstractFactory::class,
Middleware\QrCodeCacheMiddleware::class => ConfigAbstractFactory::class,
2016-07-19 19:01:39 +03:00
],
],
ConfigAbstractFactory::class => [
// Services
Service\UrlShortener::class => ['httpClient', 'em', Cache::class, 'config.url_shortener.shortcode_chars'],
Service\VisitsTracker::class => ['em'],
Service\ShortUrlService::class => ['em'],
Service\VisitService::class => ['em'],
Service\Tag\TagService::class => ['em'],
// Middleware
Action\RedirectAction::class => [Service\UrlShortener::class, Service\VisitsTracker::class, 'Logger_Shlink'],
Action\QrCodeAction::class => [RouterInterface::class, Service\UrlShortener::class, 'Logger_Shlink'],
Action\PreviewAction::class => [PreviewGenerator::class, Service\UrlShortener::class],
Middleware\QrCodeCacheMiddleware::class => [Cache::class],
],
2016-07-19 19:01:39 +03:00
];