Migrate dev-specific configuration to env vars via .env file

This commit is contained in:
Alejandro Celaya
2024-10-16 08:55:38 +02:00
parent 549a8d8837
commit 582033ceb3
101 changed files with 475 additions and 543 deletions

View File

@@ -12,7 +12,7 @@ use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\SvgWriter;
use Endroid\QrCode\Writer\WriterInterface;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Core\Options\QrCodeOptions;
use Shlinkio\Shlink\Core\Config\Options\QrCodeOptions;
use function ctype_xdigit;
use function hexdec;

View File

@@ -13,8 +13,8 @@ use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Common\Response\QrCodeResponse;
use Shlinkio\Shlink\Core\Action\Model\QrCodeParams;
use Shlinkio\Shlink\Core\Config\Options\QrCodeOptions;
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
use Shlinkio\Shlink\Core\Options\QrCodeOptions;
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifierInterface;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\ShortUrl\ShortUrlResolverInterface;

View File

@@ -9,8 +9,8 @@ use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Config\Options\RobotsOptions;
use Shlinkio\Shlink\Core\Crawling\CrawlingHelperInterface;
use Shlinkio\Shlink\Core\Options\RobotsOptions;
use function sprintf;

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
namespace Shlinkio\Shlink\Core\Config\Options;
use function sprintf;

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use const Shlinkio\Shlink\DEFAULT_DELETE_SHORT_URL_THRESHOLD;
final readonly class DeleteShortUrlsOptions
{
public function __construct(
public int $visitsThreshold = DEFAULT_DELETE_SHORT_URL_THRESHOLD,
public bool $checkVisitsThreshold = true,
) {
}
public static function fromEnv(): self
{
$threshold = EnvVars::DELETE_SHORT_URL_THRESHOLD->loadFromEnv();
return new self(
visitsThreshold: (int) ($threshold ?? DEFAULT_DELETE_SHORT_URL_THRESHOLD),
checkVisitsThreshold: $threshold !== null,
);
}
}

View File

@@ -2,19 +2,29 @@
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use Shlinkio\Shlink\Core\Config\NotFoundRedirectConfigInterface;
final class NotFoundRedirectOptions implements NotFoundRedirectConfigInterface
final readonly class NotFoundRedirectOptions implements NotFoundRedirectConfigInterface
{
public function __construct(
public readonly ?string $invalidShortUrl = null,
public readonly ?string $regular404 = null,
public readonly ?string $baseUrl = null,
public ?string $invalidShortUrl = null,
public ?string $regular404 = null,
public ?string $baseUrl = null,
) {
}
public static function fromEnv(): self
{
return new self(
invalidShortUrl: EnvVars::DEFAULT_INVALID_SHORT_URL_REDIRECT->loadFromEnv(),
regular404: EnvVars::DEFAULT_REGULAR_404_REDIRECT->loadFromEnv(),
baseUrl: EnvVars::DEFAULT_BASE_URL_REDIRECT->loadFromEnv(),
);
}
public function invalidShortUrlRedirect(): ?string
{
return $this->invalidShortUrl;

View File

@@ -2,7 +2,9 @@
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use const Shlinkio\Shlink\DEFAULT_QR_CODE_BG_COLOR;
use const Shlinkio\Shlink\DEFAULT_QR_CODE_COLOR;
@@ -13,7 +15,7 @@ use const Shlinkio\Shlink\DEFAULT_QR_CODE_MARGIN;
use const Shlinkio\Shlink\DEFAULT_QR_CODE_ROUND_BLOCK_SIZE;
use const Shlinkio\Shlink\DEFAULT_QR_CODE_SIZE;
readonly final class QrCodeOptions
final readonly class QrCodeOptions
{
public function __construct(
public int $size = DEFAULT_QR_CODE_SIZE,
@@ -27,4 +29,19 @@ readonly final class QrCodeOptions
public ?string $logoUrl = null,
) {
}
public static function fromEnv(): self
{
return new self(
size: (int) EnvVars::DEFAULT_QR_CODE_SIZE->loadFromEnv(),
margin: (int) EnvVars::DEFAULT_QR_CODE_MARGIN->loadFromEnv(),
format: EnvVars::DEFAULT_QR_CODE_FORMAT->loadFromEnv(),
errorCorrection: EnvVars::DEFAULT_QR_CODE_ERROR_CORRECTION->loadFromEnv(),
roundBlockSize: (bool) EnvVars::DEFAULT_QR_CODE_ROUND_BLOCK_SIZE->loadFromEnv(),
enabledForDisabledShortUrls: (bool) EnvVars::QR_CODE_FOR_DISABLED_SHORT_URLS->loadFromEnv(),
color: EnvVars::DEFAULT_QR_CODE_COLOR->loadFromEnv(),
bgColor: EnvVars::DEFAULT_QR_CODE_BG_COLOR->loadFromEnv(),
logoUrl: EnvVars::DEFAULT_QR_CODE_LOGO_URL->loadFromEnv(),
);
}
}

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
final readonly class RabbitMqOptions
{
public function __construct(public bool $enabled = false)
{
}
public static function fromEnv(): self
{
return new self((bool) EnvVars::RABBITMQ_ENABLED->loadFromEnv());
}
}

View File

@@ -2,18 +2,19 @@
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
namespace Shlinkio\Shlink\Core\Config\Options;
use Fig\Http\Message\StatusCodeInterface;
use Shlinkio\Shlink\Core\Config\EnvVars;
use Shlinkio\Shlink\Core\Util\RedirectStatus;
use const Shlinkio\Shlink\DEFAULT_REDIRECT_CACHE_LIFETIME;
use const Shlinkio\Shlink\DEFAULT_REDIRECT_STATUS_CODE;
final class RedirectOptions
final readonly class RedirectOptions
{
public readonly RedirectStatus $redirectStatusCode;
public readonly int $redirectCacheLifetime;
public RedirectStatus $redirectStatusCode;
public int $redirectCacheLifetime;
public function __construct(
int $redirectStatusCode = StatusCodeInterface::STATUS_FOUND,
@@ -24,4 +25,12 @@ final class RedirectOptions
? $redirectCacheLifetime
: DEFAULT_REDIRECT_CACHE_LIFETIME;
}
public static function fromEnv(): self
{
return new self(
redirectStatusCode: (int) EnvVars::REDIRECT_STATUS_CODE->loadFromEnv(),
redirectCacheLifetime: (int) EnvVars::REDIRECT_CACHE_LIFETIME->loadFromEnv(),
);
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use function count;
use function Shlinkio\Shlink\Core\splitByComma;
final readonly class RobotsOptions
{
/**
* @param string[] $userAgents
*/
public function __construct(public bool $allowAllShortUrls = false, public array $userAgents = [])
{
}
public static function fromEnv(): self
{
return new self(
allowAllShortUrls: (bool) EnvVars::ROBOTS_ALLOW_ALL_SHORT_URLS->loadFromEnv(),
userAgents: splitByComma(EnvVars::ROBOTS_USER_AGENTS->loadFromEnv()),
);
}
public function hasUserAgents(): bool
{
return count($this->userAgents) > 0;
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use function array_key_exists;
use function Shlinkio\Shlink\Core\splitByComma;
final readonly class TrackingOptions
{
/**
* @param string[] $disableTrackingFrom
*/
public function __construct(
// Tells if IP addresses should be anonymized before persisting, to fulfil data protection regulations.
// This applies only if IP address tracking is enabled
public bool $anonymizeRemoteAddr = true,
// Tells if visits to not-found URLs should be tracked. The disableTracking option takes precedence
public bool $trackOrphanVisits = true,
// A query param that, if provided, will disable tracking of one particular visit. Always takes precedence over
// other options
public ?string $disableTrackParam = null,
// If true, visits will not be tracked at all
public bool $disableTracking = false,
// If true, visits will be tracked, but neither the IP address, nor the location will be resolved
public bool $disableIpTracking = false,
// If true, the referrers will not be tracked
public bool $disableReferrerTracking = false,
// If true, the user agent will not be tracked
public bool $disableUaTracking = false,
// A list of IP addresses, patterns or CIDR blocks from which tracking is disabled by default
public array $disableTrackingFrom = [],
) {
}
public static function fromEnv(): self
{
return new self(
anonymizeRemoteAddr: (bool) EnvVars::ANONYMIZE_REMOTE_ADDR->loadFromEnv(),
trackOrphanVisits: (bool) EnvVars::TRACK_ORPHAN_VISITS->loadFromEnv(),
disableTrackParam: EnvVars::DISABLE_TRACK_PARAM->loadFromEnv(),
disableTracking: (bool) EnvVars::DISABLE_TRACKING->loadFromEnv(),
disableIpTracking: (bool) EnvVars::DISABLE_IP_TRACKING->loadFromEnv(),
disableReferrerTracking: (bool) EnvVars::DISABLE_REFERRER_TRACKING->loadFromEnv(),
disableUaTracking: (bool) EnvVars::DISABLE_UA_TRACKING->loadFromEnv(),
disableTrackingFrom: splitByComma(EnvVars::DISABLE_TRACKING_FROM->loadFromEnv()),
);
}
public function hasDisableTrackingFrom(): bool
{
return ! empty($this->disableTrackingFrom);
}
public function queryHasDisableTrackParam(array $query): bool
{
return $this->disableTrackParam !== null && array_key_exists($this->disableTrackParam, $query);
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Config\Options;
use Shlinkio\Shlink\Core\Config\EnvVars;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode;
use function max;
use const Shlinkio\Shlink\DEFAULT_SHORT_CODES_LENGTH;
use const Shlinkio\Shlink\MIN_SHORT_CODES_LENGTH;
final readonly class UrlShortenerOptions
{
/**
* @param array{schema: ?string, hostname: ?string} $domain
*/
public function __construct(
public array $domain = ['schema' => null, 'hostname' => null],
public int $defaultShortCodesLength = DEFAULT_SHORT_CODES_LENGTH,
public bool $autoResolveTitles = false,
public bool $appendExtraPath = false,
public bool $multiSegmentSlugsEnabled = false,
public bool $trailingSlashEnabled = false,
public ShortUrlMode $mode = ShortUrlMode::STRICT,
) {
}
public static function fromEnv(): self
{
$shortCodesLength = max(
(int) EnvVars::DEFAULT_SHORT_CODES_LENGTH->loadFromEnv(),
MIN_SHORT_CODES_LENGTH,
);
$mode = EnvVars::SHORT_URL_MODE->loadFromEnv();
return new self(
domain: [
'schema' => ((bool) EnvVars::IS_HTTPS_ENABLED->loadFromEnv()) ? 'https' : 'http',
'hostname' => EnvVars::DEFAULT_DOMAIN->loadFromEnv(),
],
defaultShortCodesLength: $shortCodesLength,
autoResolveTitles: (bool) EnvVars::AUTO_RESOLVE_TITLES->loadFromEnv(),
appendExtraPath: (bool) EnvVars::REDIRECT_APPEND_EXTRA_PATH->loadFromEnv(),
multiSegmentSlugsEnabled: (bool) EnvVars::MULTI_SEGMENT_SLUGS_ENABLED->loadFromEnv(),
trailingSlashEnabled: (bool) EnvVars::SHORT_URL_TRAILING_SLASH->loadFromEnv(),
mode: ShortUrlMode::tryFrom($mode) ?? ShortUrlMode::STRICT,
);
}
public function isLooseMode(): bool
{
return $this->mode === ShortUrlMode::LOOSE;
}
public function defaultDomain(): string
{
return $this->domain['hostname'] ?? '';
}
}

View File

@@ -9,15 +9,15 @@ use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Config;
use Shlinkio\Shlink\Core\Config\NotFoundRedirectResolverInterface;
use Shlinkio\Shlink\Core\Domain\DomainServiceInterface;
use Shlinkio\Shlink\Core\ErrorHandler\Model\NotFoundType;
use Shlinkio\Shlink\Core\Options;
class NotFoundRedirectHandler implements MiddlewareInterface
readonly class NotFoundRedirectHandler implements MiddlewareInterface
{
public function __construct(
private Options\NotFoundRedirectOptions $redirectOptions,
private Config\Options\NotFoundRedirectOptions $redirectOptions,
private NotFoundRedirectResolverInterface $redirectResolver,
private DomainServiceInterface $domainService,
) {

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\EventDispatcher\Helper;
use Shlinkio\Shlink\Common\Mercure\MercureOptions;
use Shlinkio\Shlink\Core\Config\Options\RabbitMqOptions;
use Shlinkio\Shlink\Core\EventDispatcher;
use Shlinkio\Shlink\Core\Matomo\MatomoOptions;
use Shlinkio\Shlink\Core\Options\RabbitMqOptions;
use Shlinkio\Shlink\EventDispatcher\Listener\EnabledListenerCheckerInterface;
use Shlinkio\Shlink\IpGeolocation\GeoLite2\GeoLite2Options;

View File

@@ -7,10 +7,10 @@ namespace Shlinkio\Shlink\Core\EventDispatcher\RabbitMq;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
use Shlinkio\Shlink\Core\Config\Options\RabbitMqOptions;
use Shlinkio\Shlink\Core\EventDispatcher\Async\AbstractNotifyNewShortUrlListener;
use Shlinkio\Shlink\Core\EventDispatcher\Async\RemoteSystem;
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
use Shlinkio\Shlink\Core\Options\RabbitMqOptions;
class NotifyNewShortUrlToRabbitMq extends AbstractNotifyNewShortUrlListener
{

View File

@@ -7,10 +7,10 @@ namespace Shlinkio\Shlink\Core\EventDispatcher\RabbitMq;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
use Shlinkio\Shlink\Core\Config\Options\RabbitMqOptions;
use Shlinkio\Shlink\Core\EventDispatcher\Async\AbstractNotifyVisitListener;
use Shlinkio\Shlink\Core\EventDispatcher\Async\RemoteSystem;
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
use Shlinkio\Shlink\Core\Options\RabbitMqOptions;
class NotifyVisitToRabbitMq extends AbstractNotifyVisitListener
{

View File

@@ -4,17 +4,31 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Matomo;
class MatomoOptions
use Shlinkio\Shlink\Core\Config\EnvVars;
final readonly class MatomoOptions
{
/**
* @param numeric-string|int|null $siteId
*/
public function __construct(
public readonly bool $enabled = false,
public readonly ?string $baseUrl = null,
/** @var numeric-string|int|null */
private readonly string|int|null $siteId = null,
public readonly ?string $apiToken = null,
public bool $enabled = false,
public ?string $baseUrl = null,
private string|int|null $siteId = null,
public ?string $apiToken = null,
) {
}
public static function fromEnv(): self
{
return new self(
enabled: (bool) EnvVars::MATOMO_ENABLED->loadFromEnv(),
baseUrl: EnvVars::MATOMO_BASE_URL->loadFromEnv(),
siteId: EnvVars::MATOMO_SITE_ID->loadFromEnv(),
apiToken: EnvVars::MATOMO_API_TOKEN->loadFromEnv(),
);
}
public function siteId(): ?int
{
if ($this->siteId === null) {

View File

@@ -1,16 +0,0 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
use const Shlinkio\Shlink\DEFAULT_DELETE_SHORT_URL_THRESHOLD;
final class DeleteShortUrlsOptions
{
public function __construct(
public readonly int $visitsThreshold = DEFAULT_DELETE_SHORT_URL_THRESHOLD,
public readonly bool $checkVisitsThreshold = true,
) {
}
}

View File

@@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
final readonly class RabbitMqOptions
{
public function __construct(
public bool $enabled = false,
) {
}
}

View File

@@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
use function count;
final readonly class RobotsOptions
{
public function __construct(
public bool $allowAllShortUrls = false,
/** @var string[] */
public array $userAgents = [],
) {
}
public function hasUserAgents(): bool
{
return count($this->userAgents) > 0;
}
}

View File

@@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
use function array_key_exists;
final class TrackingOptions
{
public function __construct(
public readonly bool $anonymizeRemoteAddr = true,
public readonly bool $trackOrphanVisits = true,
public readonly ?string $disableTrackParam = null,
public readonly bool $disableTracking = false,
public readonly bool $disableIpTracking = false,
public readonly bool $disableReferrerTracking = false,
public readonly bool $disableUaTracking = false,
/** @var string[] */
public readonly array $disableTrackingFrom = [],
) {
}
public function hasDisableTrackingFrom(): bool
{
return ! empty($this->disableTrackingFrom);
}
public function queryHasDisableTrackParam(array $query): bool
{
return $this->disableTrackParam !== null && array_key_exists($this->disableTrackParam, $query);
}
}

View File

@@ -1,36 +0,0 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Options;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode;
use const Shlinkio\Shlink\DEFAULT_SHORT_CODES_LENGTH;
final class UrlShortenerOptions
{
/**
* @param array{schema: ?string, hostname: ?string} $domain
*/
public function __construct(
public readonly array $domain = ['schema' => null, 'hostname' => null],
public readonly int $defaultShortCodesLength = DEFAULT_SHORT_CODES_LENGTH,
public readonly bool $autoResolveTitles = false,
public readonly bool $appendExtraPath = false,
public readonly bool $multiSegmentSlugsEnabled = false,
public readonly bool $trailingSlashEnabled = false,
public readonly ShortUrlMode $mode = ShortUrlMode::STRICT,
) {
}
public function isLooseMode(): bool
{
return $this->mode === ShortUrlMode::LOOSE;
}
public function defaultDomain(): string
{
return $this->domain['hostname'] ?? '';
}
}

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl;
use Doctrine\ORM\EntityManagerInterface;
use Shlinkio\Shlink\Core\Config\Options\DeleteShortUrlsOptions;
use Shlinkio\Shlink\Core\Exception;
use Shlinkio\Shlink\Core\Options\DeleteShortUrlsOptions;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
use Shlinkio\Shlink\Core\ShortUrl\Model\ExpiredShortUrlsConditions;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlIdentifier;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl\Helper;
use Doctrine\ORM\EntityManagerInterface;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\ShortUrl\Repository\ShortUrlRepository;

View File

@@ -8,7 +8,7 @@ use GuzzleHttp\Psr7\Query;
use GuzzleHttp\Psr7\Uri;
use Laminas\Stdlib\ArrayUtils;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\Config\Options\TrackingOptions;
use Shlinkio\Shlink\Core\RedirectRule\ShortUrlRedirectionResolverInterface;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;

View File

@@ -8,7 +8,7 @@ use Fig\Http\Message\RequestMethodInterface;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\RequestOptions;
use Psr\Http\Message\ResponseInterface;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Throwable;
use function html_entity_decode;

View File

@@ -9,9 +9,9 @@ use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ErrorHandler\Model\NotFoundType;
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlRedirectionBuilderInterface;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\ShortUrl\ShortUrlResolverInterface;

View File

@@ -8,7 +8,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use function rtrim;

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl\Model;
use Cake\Chronos\Chronos;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Exception\ValidationException;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ShortUrl\Helper\TitleResolutionModelInterface;
use Shlinkio\Shlink\Core\ShortUrl\Model\Validation\ShortUrlInputFilter;
use Shlinkio\Shlink\Rest\Entity\ApiKey;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl\Model\Validation;
use Laminas\Filter\FilterInterface;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use function is_string;
use function str_replace;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl\Model\Validation;
use Laminas\Validator\AbstractValidator;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use function is_string;
use function strpbrk;

View File

@@ -10,7 +10,7 @@ use Laminas\InputFilter\InputFilter;
use Laminas\Validator;
use Shlinkio\Shlink\Common\Validation\HostAndPortValidator;
use Shlinkio\Shlink\Common\Validation\InputFactory;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
use function is_string;

View File

@@ -8,8 +8,8 @@ use Doctrine\Common\Collections;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Events;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Domain\Entity\Domain;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Tag\Entity\Tag;
use Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\LockFactory;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl;
use Shlinkio\Shlink\Common\Paginator\Paginator;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\ShortUrl\Paginator\Adapter\ShortUrlRepositoryAdapter;
use Shlinkio\Shlink\Core\ShortUrl\Repository\ShortUrlListRepositoryInterface;

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl;
use Doctrine\ORM\EntityManagerInterface;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\ShortUrl\Repository\ShortUrlRepository;

View File

@@ -6,7 +6,7 @@ namespace Shlinkio\Shlink\Core\Util;
use Laminas\Diactoros\Response\RedirectResponse;
use Psr\Http\Message\ResponseInterface;
use Shlinkio\Shlink\Core\Options\RedirectOptions;
use Shlinkio\Shlink\Core\Config\Options\RedirectOptions;
use function sprintf;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Visit\Model;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\Config\Options\TrackingOptions;
use function Shlinkio\Shlink\Core\ipAddressFromRequest;
use function Shlinkio\Shlink\Core\isCrawler;

View File

@@ -7,9 +7,9 @@ namespace Shlinkio\Shlink\Core\Visit;
use Fig\Http\Message\RequestMethodInterface;
use Mezzio\Router\Middleware\ImplicitHeadMiddleware;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Core\Config\Options\TrackingOptions;
use Shlinkio\Shlink\Core\ErrorHandler\Model\NotFoundType;
use Shlinkio\Shlink\Core\Exception\InvalidIpFormatException;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Util\IpAddressUtils;
use Shlinkio\Shlink\Core\Visit\Model\Visitor;

View File

@@ -6,8 +6,8 @@ namespace Shlinkio\Shlink\Core\Visit;
use Doctrine\ORM;
use Psr\EventDispatcher\EventDispatcherInterface;
use Shlinkio\Shlink\Core\Config\Options\TrackingOptions;
use Shlinkio\Shlink\Core\EventDispatcher\Event\UrlVisited;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Visit\Entity\Visit;
use Shlinkio\Shlink\Core\Visit\Model\Visitor;