From a06957e9fa05c22085d0a9475147134260e1a4bf Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 7 Jan 2023 13:04:46 +0100 Subject: [PATCH] Moved config post-processors to their own sub-namespace --- config/config.php | 4 ++-- .../Core/src/Config/{ => PostProcessor}/BasePathPrefixer.php | 2 +- .../Config/{ => PostProcessor}/MultiSegmentSlugProcessor.php | 2 +- module/Core/src/Util/RedirectStatus.php | 5 +++++ .../test/Config/{ => PostProcessor}/BasePathPrefixerTest.php | 4 ++-- .../{ => PostProcessor}/MultiSegmentSlugProcessorTest.php | 4 ++-- 6 files changed, 13 insertions(+), 8 deletions(-) rename module/Core/src/Config/{ => PostProcessor}/BasePathPrefixer.php (94%) rename module/Core/src/Config/{ => PostProcessor}/MultiSegmentSlugProcessor.php (93%) rename module/Core/test/Config/{ => PostProcessor}/BasePathPrefixerTest.php (92%) rename module/Core/test/Config/{ => PostProcessor}/MultiSegmentSlugProcessorTest.php (92%) diff --git a/config/config.php b/config/config.php index 15a45348..a002c329 100644 --- a/config/config.php +++ b/config/config.php @@ -48,6 +48,6 @@ return (new ConfigAggregator\ConfigAggregator([ // Routes have to be loaded last new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'), ], 'data/cache/app_config.php', [ - Core\Config\BasePathPrefixer::class, - Core\Config\MultiSegmentSlugProcessor::class, + Core\Config\PostProcessor\BasePathPrefixer::class, + Core\Config\PostProcessor\MultiSegmentSlugProcessor::class, ]))->getMergedConfig(); diff --git a/module/Core/src/Config/BasePathPrefixer.php b/module/Core/src/Config/PostProcessor/BasePathPrefixer.php similarity index 94% rename from module/Core/src/Config/BasePathPrefixer.php rename to module/Core/src/Config/PostProcessor/BasePathPrefixer.php index 4a306287..619e6056 100644 --- a/module/Core/src/Config/BasePathPrefixer.php +++ b/module/Core/src/Config/PostProcessor/BasePathPrefixer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Config; +namespace Shlinkio\Shlink\Core\Config\PostProcessor; use function Functional\map; diff --git a/module/Core/src/Config/MultiSegmentSlugProcessor.php b/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php similarity index 93% rename from module/Core/src/Config/MultiSegmentSlugProcessor.php rename to module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php index b9cf2457..b84491f6 100644 --- a/module/Core/src/Config/MultiSegmentSlugProcessor.php +++ b/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Config; +namespace Shlinkio\Shlink\Core\Config\PostProcessor; use function Functional\map; use function str_replace; diff --git a/module/Core/src/Util/RedirectStatus.php b/module/Core/src/Util/RedirectStatus.php index d14e4fea..a36719d2 100644 --- a/module/Core/src/Util/RedirectStatus.php +++ b/module/Core/src/Util/RedirectStatus.php @@ -17,4 +17,9 @@ enum RedirectStatus: int { return contains([self::STATUS_301, self::STATUS_308], $this); } + + public function isLegacyStatus(): bool + { + return contains([self::STATUS_301, self::STATUS_302], $this); + } } diff --git a/module/Core/test/Config/BasePathPrefixerTest.php b/module/Core/test/Config/PostProcessor/BasePathPrefixerTest.php similarity index 92% rename from module/Core/test/Config/BasePathPrefixerTest.php rename to module/Core/test/Config/PostProcessor/BasePathPrefixerTest.php index 2298a59c..90c1449a 100644 --- a/module/Core/test/Config/BasePathPrefixerTest.php +++ b/module/Core/test/Config/PostProcessor/BasePathPrefixerTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace ShlinkioTest\Shlink\Core\Config; +namespace ShlinkioTest\Shlink\Core\Config\PostProcessor; use PHPUnit\Framework\TestCase; -use Shlinkio\Shlink\Core\Config\BasePathPrefixer; +use Shlinkio\Shlink\Core\Config\PostProcessor\BasePathPrefixer; class BasePathPrefixerTest extends TestCase { diff --git a/module/Core/test/Config/MultiSegmentSlugProcessorTest.php b/module/Core/test/Config/PostProcessor/MultiSegmentSlugProcessorTest.php similarity index 92% rename from module/Core/test/Config/MultiSegmentSlugProcessorTest.php rename to module/Core/test/Config/PostProcessor/MultiSegmentSlugProcessorTest.php index 630a5d90..cef07a86 100644 --- a/module/Core/test/Config/MultiSegmentSlugProcessorTest.php +++ b/module/Core/test/Config/PostProcessor/MultiSegmentSlugProcessorTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace ShlinkioTest\Shlink\Core\Config; +namespace ShlinkioTest\Shlink\Core\Config\PostProcessor; use PHPUnit\Framework\TestCase; -use Shlinkio\Shlink\Core\Config\MultiSegmentSlugProcessor; +use Shlinkio\Shlink\Core\Config\PostProcessor\MultiSegmentSlugProcessor; class MultiSegmentSlugProcessorTest extends TestCase {