diff --git a/composer.json b/composer.json index bd9b4fcad1..eb7fdc6cd5 100644 --- a/composer.json +++ b/composer.json @@ -149,6 +149,8 @@ "EonX\\EasyTemplatingBlock\\Bundle\\": "packages/EasyTemplatingBlock/bundle", "EonX\\EasyTest\\": "packages/EasyTest/src", "EonX\\EasyUtils\\": "packages/EasyUtils/src", + "EonX\\EasyUtils\\Bundle\\": "packages/EasyUtils/bundle", + "EonX\\EasyUtils\\Laravel\\": "packages/EasyUtils/laravel", "EonX\\EasyWebhook\\": "packages/EasyWebhook/src", "EonX\\EasyWebhook\\Bundle\\": "packages/EasyWebhook/bundle", "EonX\\EasyWebhook\\Laravel\\": "packages/EasyWebhook/laravel" @@ -234,6 +236,9 @@ "EonX\\EasyTest\\Tests\\": "packages/EasyTest/tests", "EonX\\EasyTest\\Tests\\Unit\\": "packages/EasyTest/tests/Unit/src", "EonX\\EasyUtils\\Tests\\": "packages/EasyUtils/tests", + "EonX\\EasyUtils\\Tests\\Unit\\": "packages/EasyUtils/tests/Unit/src", + "EonX\\EasyUtils\\Tests\\Unit\\Bundle\\": "packages/EasyUtils/tests/Unit/bundle", + "EonX\\EasyUtils\\Tests\\Unit\\Laravel\\": "packages/EasyUtils/tests/Unit/laravel", "EonX\\EasyWebhook\\Tests\\": "packages/EasyWebhook/tests", "EonX\\EasyWebhook\\Tests\\Unit\\": "packages/EasyWebhook/tests/Unit/src", "EonX\\EasyWebhook\\Tests\\Unit\\Bundle\\": "packages/EasyWebhook/tests/Unit/bundle", diff --git a/monorepo/Console/MonorepoApplication.php b/monorepo/Console/MonorepoApplication.php index e6b0898c90..2884cb7c1c 100644 --- a/monorepo/Console/MonorepoApplication.php +++ b/monorepo/Console/MonorepoApplication.php @@ -3,7 +3,7 @@ namespace EonX\EasyMonorepo\Console; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; diff --git a/packages/EasyApiToken/src/Common/Decoder/ChainDecoder.php b/packages/EasyApiToken/src/Common/Decoder/ChainDecoder.php index 9e9fcc4eeb..0ca4c92e84 100644 --- a/packages/EasyApiToken/src/Common/Decoder/ChainDecoder.php +++ b/packages/EasyApiToken/src/Common/Decoder/ChainDecoder.php @@ -4,7 +4,7 @@ namespace EonX\EasyApiToken\Common\Decoder; use EonX\EasyApiToken\Common\ValueObject\ApiTokenInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpFoundation\Request; final class ChainDecoder extends AbstractDecoder diff --git a/packages/EasyApiToken/src/Common/Driver/HashedApiKeyDriver.php b/packages/EasyApiToken/src/Common/Driver/HashedApiKeyDriver.php index 9cf169b760..4907951e18 100644 --- a/packages/EasyApiToken/src/Common/Driver/HashedApiKeyDriver.php +++ b/packages/EasyApiToken/src/Common/Driver/HashedApiKeyDriver.php @@ -5,7 +5,7 @@ use EonX\EasyApiToken\Common\ValueObject\HashedApiKey; use EonX\EasyApiToken\Common\ValueObject\HashedApiKeyInterface; -use EonX\EasyUtils\Helpers\UrlHelper; +use EonX\EasyUtils\Common\Helper\UrlHelper; final class HashedApiKeyDriver implements HashedApiKeyDriverInterface { diff --git a/packages/EasyApiToken/src/Common/Factory/ApiTokenDecoderFactory.php b/packages/EasyApiToken/src/Common/Factory/ApiTokenDecoderFactory.php index 3cfad1ae7e..0ac8b6ef6e 100644 --- a/packages/EasyApiToken/src/Common/Factory/ApiTokenDecoderFactory.php +++ b/packages/EasyApiToken/src/Common/Factory/ApiTokenDecoderFactory.php @@ -9,7 +9,7 @@ use EonX\EasyApiToken\Common\Exception\InvalidConfigurationException; use EonX\EasyApiToken\Common\Exception\InvalidDefaultDecoderException; use EonX\EasyApiToken\Common\Provider\DecoderProviderInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class ApiTokenDecoderFactory implements ApiTokenDecoderFactoryInterface { diff --git a/packages/EasyApiToken/src/Common/Provider/DecoderProviderInterface.php b/packages/EasyApiToken/src/Common/Provider/DecoderProviderInterface.php index d7ed0f9f05..db8d16fbaf 100644 --- a/packages/EasyApiToken/src/Common/Provider/DecoderProviderInterface.php +++ b/packages/EasyApiToken/src/Common/Provider/DecoderProviderInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyApiToken\Common\Provider; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface DecoderProviderInterface extends HasPriorityInterface { diff --git a/packages/EasyApiToken/tests/Stub/Common/Decoder/DecoderProviderStub.php b/packages/EasyApiToken/tests/Stub/Common/Decoder/DecoderProviderStub.php index 3cb5ddef39..0812749405 100644 --- a/packages/EasyApiToken/tests/Stub/Common/Decoder/DecoderProviderStub.php +++ b/packages/EasyApiToken/tests/Stub/Common/Decoder/DecoderProviderStub.php @@ -5,7 +5,7 @@ use EonX\EasyApiToken\Common\Decoder\BasicAuthDecoder; use EonX\EasyApiToken\Common\Provider\DecoderProviderInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; final class DecoderProviderStub implements DecoderProviderInterface { diff --git a/packages/EasyBatch/src/Bridge/Symfony/Messenger/BatchItemExceptionHandler.php b/packages/EasyBatch/src/Bridge/Symfony/Messenger/BatchItemExceptionHandler.php index a08c3e75b5..bc0218ad47 100644 --- a/packages/EasyBatch/src/Bridge/Symfony/Messenger/BatchItemExceptionHandler.php +++ b/packages/EasyBatch/src/Bridge/Symfony/Messenger/BatchItemExceptionHandler.php @@ -11,7 +11,7 @@ use EonX\EasyBatch\Interfaces\EasyBatchExceptionInterface; use EonX\EasyBatch\Interfaces\EasyBatchPreventProcessExceptionInterface; use EonX\EasyBatch\Transformers\BatchItemTransformer; -use EonX\EasyUtils\Helpers\ErrorDetailsHelper; +use EonX\EasyUtils\Common\Helper\ErrorDetailsHelper; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Exception\ExceptionInterface as MessengerExceptionInterface; diff --git a/packages/EasyBatch/src/Transformers/AbstractBatchObjectTransformer.php b/packages/EasyBatch/src/Transformers/AbstractBatchObjectTransformer.php index dbc5051a47..ecd8b0bdf5 100644 --- a/packages/EasyBatch/src/Transformers/AbstractBatchObjectTransformer.php +++ b/packages/EasyBatch/src/Transformers/AbstractBatchObjectTransformer.php @@ -7,7 +7,7 @@ use DateTimeInterface; use EonX\EasyBatch\Interfaces\BatchObjectInterface; use EonX\EasyBatch\Interfaces\BatchObjectTransformerInterface; -use EonX\EasyUtils\Helpers\ErrorDetailsHelper; +use EonX\EasyUtils\Common\Helper\ErrorDetailsHelper; use Throwable; abstract class AbstractBatchObjectTransformer implements BatchObjectTransformerInterface diff --git a/packages/EasyBugsnag/src/Bridge/EasyUtils/SensitiveDataSanitizerConfigurator.php b/packages/EasyBugsnag/src/Bridge/EasyUtils/SensitiveDataSanitizerConfigurator.php index e50d4a5f29..a71cff8295 100644 --- a/packages/EasyBugsnag/src/Bridge/EasyUtils/SensitiveDataSanitizerConfigurator.php +++ b/packages/EasyBugsnag/src/Bridge/EasyUtils/SensitiveDataSanitizerConfigurator.php @@ -6,7 +6,7 @@ use Bugsnag\Client; use Bugsnag\Report; use EonX\EasyBugsnag\Configurators\AbstractClientConfigurator; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; final class SensitiveDataSanitizerConfigurator extends AbstractClientConfigurator { diff --git a/packages/EasyBugsnag/src/Bridge/Laravel/EasyBugsnagServiceProvider.php b/packages/EasyBugsnag/src/Bridge/Laravel/EasyBugsnagServiceProvider.php index 7084caac11..5d4dde97fb 100644 --- a/packages/EasyBugsnag/src/Bridge/Laravel/EasyBugsnagServiceProvider.php +++ b/packages/EasyBugsnag/src/Bridge/Laravel/EasyBugsnagServiceProvider.php @@ -22,7 +22,7 @@ use EonX\EasyBugsnag\Resolvers\DefaultAppNameResolver; use EonX\EasyBugsnag\Session\SessionTracker; use EonX\EasyBugsnag\Shutdown\ShutdownStrategy; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; use Illuminate\Contracts\Cache\Repository; use Illuminate\Contracts\Container\Container; use Illuminate\Queue\Events\JobProcessing; diff --git a/packages/EasyBugsnag/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php b/packages/EasyBugsnag/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php index 8943bc6ba7..5460bf91b4 100644 --- a/packages/EasyBugsnag/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php +++ b/packages/EasyBugsnag/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php @@ -6,7 +6,7 @@ use EonX\EasyBugsnag\Bridge\BridgeConstantsInterface; use EonX\EasyBugsnag\Bridge\EasyUtils\Exceptions\EasyUtilsNotInstalledException; use EonX\EasyBugsnag\Bridge\EasyUtils\SensitiveDataSanitizerConfigurator; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; diff --git a/packages/EasyBugsnag/src/ClientFactory.php b/packages/EasyBugsnag/src/ClientFactory.php index db546be186..98e8ae6d5a 100644 --- a/packages/EasyBugsnag/src/ClientFactory.php +++ b/packages/EasyBugsnag/src/ClientFactory.php @@ -9,7 +9,7 @@ use Bugsnag\Shutdown\ShutdownStrategyInterface; use EonX\EasyBugsnag\Interfaces\ClientConfiguratorInterface; use EonX\EasyBugsnag\Interfaces\ClientFactoryInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use GuzzleHttp\ClientInterface; final class ClientFactory implements ClientFactoryInterface diff --git a/packages/EasyBugsnag/src/Interfaces/ClientConfiguratorInterface.php b/packages/EasyBugsnag/src/Interfaces/ClientConfiguratorInterface.php index 9dbd64e35d..1887800af6 100644 --- a/packages/EasyBugsnag/src/Interfaces/ClientConfiguratorInterface.php +++ b/packages/EasyBugsnag/src/Interfaces/ClientConfiguratorInterface.php @@ -4,7 +4,7 @@ namespace EonX\EasyBugsnag\Interfaces; use Bugsnag\Client; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface ClientConfiguratorInterface extends HasPriorityInterface { diff --git a/packages/EasyBugsnag/tests/Bridge/Laravel/AbstractLaravelTestCase.php b/packages/EasyBugsnag/tests/Bridge/Laravel/AbstractLaravelTestCase.php index 1bc21d208d..3e28dd71d9 100644 --- a/packages/EasyBugsnag/tests/Bridge/Laravel/AbstractLaravelTestCase.php +++ b/packages/EasyBugsnag/tests/Bridge/Laravel/AbstractLaravelTestCase.php @@ -5,7 +5,7 @@ use EonX\EasyBugsnag\Bridge\Laravel\EasyBugsnagServiceProvider; use EonX\EasyBugsnag\Tests\AbstractTestCase; -use EonX\EasyUtils\Bridge\Laravel\EasyUtilsServiceProvider; +use EonX\EasyUtils\Laravel\EasyUtilsServiceProvider; use Laravel\Lumen\Application; abstract class AbstractLaravelTestCase extends AbstractTestCase diff --git a/packages/EasyBugsnag/tests/Bridge/Symfony/Stubs/KernelStub.php b/packages/EasyBugsnag/tests/Bridge/Symfony/Stubs/KernelStub.php index 345fed8158..f5fb18a42a 100644 --- a/packages/EasyBugsnag/tests/Bridge/Symfony/Stubs/KernelStub.php +++ b/packages/EasyBugsnag/tests/Bridge/Symfony/Stubs/KernelStub.php @@ -4,7 +4,7 @@ namespace EonX\EasyBugsnag\Tests\Bridge\Symfony\Stubs; use EonX\EasyBugsnag\Bridge\Symfony\EasyBugsnagSymfonyBundle; -use EonX\EasyUtils\Bridge\Symfony\EasyUtilsSymfonyBundle; +use EonX\EasyUtils\Bundle\EasyUtilsBundle; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -70,7 +70,7 @@ public function process(ContainerBuilder $container): void public function registerBundles(): iterable { yield new EasyBugsnagSymfonyBundle(); - yield new EasyUtilsSymfonyBundle(); + yield new EasyUtilsBundle(); } /** diff --git a/packages/EasyDecision/src/Configurator/AddRulesDecisionConfigurator.php b/packages/EasyDecision/src/Configurator/AddRulesDecisionConfigurator.php index 4fdedc045e..c1451cd451 100644 --- a/packages/EasyDecision/src/Configurator/AddRulesDecisionConfigurator.php +++ b/packages/EasyDecision/src/Configurator/AddRulesDecisionConfigurator.php @@ -6,7 +6,7 @@ use EonX\EasyDecision\Decision\DecisionInterface; use EonX\EasyDecision\Rule\RestrictedRuleInterface; use EonX\EasyDecision\Rule\RuleInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class AddRulesDecisionConfigurator extends AbstractDecisionConfigurator { diff --git a/packages/EasyDecision/src/Configurator/DecisionConfiguratorInterface.php b/packages/EasyDecision/src/Configurator/DecisionConfiguratorInterface.php index b9ce043852..b6abd5dc3a 100644 --- a/packages/EasyDecision/src/Configurator/DecisionConfiguratorInterface.php +++ b/packages/EasyDecision/src/Configurator/DecisionConfiguratorInterface.php @@ -4,7 +4,7 @@ namespace EonX\EasyDecision\Configurator; use EonX\EasyDecision\Decision\DecisionInterface; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface DecisionConfiguratorInterface extends HasPriorityInterface { diff --git a/packages/EasyDecision/src/Decision/AbstractDecision.php b/packages/EasyDecision/src/Decision/AbstractDecision.php index 6951faec37..3a0c810fbc 100644 --- a/packages/EasyDecision/src/Decision/AbstractDecision.php +++ b/packages/EasyDecision/src/Decision/AbstractDecision.php @@ -15,7 +15,7 @@ use EonX\EasyDecision\ExpressionLanguage\ExpressionLanguageInterface; use EonX\EasyDecision\Rule\DecisionOutputForRuleAwareInterface; use EonX\EasyDecision\Rule\RuleInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Throwable; abstract class AbstractDecision implements DecisionInterface diff --git a/packages/EasyDecision/src/ExpressionLanguage/ExpressionLanguage.php b/packages/EasyDecision/src/ExpressionLanguage/ExpressionLanguage.php index f0e502861e..e5689dc307 100644 --- a/packages/EasyDecision/src/ExpressionLanguage/ExpressionLanguage.php +++ b/packages/EasyDecision/src/ExpressionLanguage/ExpressionLanguage.php @@ -6,7 +6,7 @@ use EonX\EasyDecision\Exception\ExpressionLanguageLockedException; use EonX\EasyDecision\Exception\InvalidExpressionException; use EonX\EasyDecision\ExpressionFunction\ExpressionFunctionInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; use Symfony\Component\ExpressionLanguage\SyntaxError; diff --git a/packages/EasyDecision/src/Factory/DecisionFactory.php b/packages/EasyDecision/src/Factory/DecisionFactory.php index 5b268c8dca..1a0f8df182 100644 --- a/packages/EasyDecision/src/Factory/DecisionFactory.php +++ b/packages/EasyDecision/src/Factory/DecisionFactory.php @@ -11,7 +11,7 @@ use EonX\EasyDecision\Decision\UnanimousDecision; use EonX\EasyDecision\Decision\ValueDecision; use EonX\EasyDecision\Provider\MappingProviderInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class DecisionFactory implements DecisionFactoryInterface { diff --git a/packages/EasyDecision/src/Rule/RuleInterface.php b/packages/EasyDecision/src/Rule/RuleInterface.php index b734736443..265f0b431d 100644 --- a/packages/EasyDecision/src/Rule/RuleInterface.php +++ b/packages/EasyDecision/src/Rule/RuleInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyDecision\Rule; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface RuleInterface extends HasPriorityInterface { diff --git a/packages/EasyDecision/tests/Stub/Rule/OutputFromInputRuleStub.php b/packages/EasyDecision/tests/Stub/Rule/OutputFromInputRuleStub.php index cc5897a6e1..7066a58226 100644 --- a/packages/EasyDecision/tests/Stub/Rule/OutputFromInputRuleStub.php +++ b/packages/EasyDecision/tests/Stub/Rule/OutputFromInputRuleStub.php @@ -4,7 +4,7 @@ namespace EonX\EasyDecision\Tests\Stub\Rule; use EonX\EasyDecision\Rule\RuleInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; final class OutputFromInputRuleStub implements RuleInterface { diff --git a/packages/EasyDoctrine/src/Common/Type/IntegerNumberType.php b/packages/EasyDoctrine/src/Common/Type/IntegerNumberType.php index dcf756842b..89f8a4205e 100644 --- a/packages/EasyDoctrine/src/Common/Type/IntegerNumberType.php +++ b/packages/EasyDoctrine/src/Common/Type/IntegerNumberType.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\BigIntType as DoctrineBigIntType; use Doctrine\DBAL\Types\ConversionException; -use EonX\EasyUtils\ValueObjects\Number; +use EonX\EasyUtils\Math\ValueObject\Number; final class IntegerNumberType extends DoctrineBigIntType { diff --git a/packages/EasyEncryption/src/Common/Provider/DefaultEncryptionKeyProvider.php b/packages/EasyEncryption/src/Common/Provider/DefaultEncryptionKeyProvider.php index 25c25cd882..496f8d5e05 100644 --- a/packages/EasyEncryption/src/Common/Provider/DefaultEncryptionKeyProvider.php +++ b/packages/EasyEncryption/src/Common/Provider/DefaultEncryptionKeyProvider.php @@ -7,7 +7,7 @@ use EonX\EasyEncryption\Common\Exception\CouldNotProvideEncryptionKeyException; use EonX\EasyEncryption\Common\Factory\EncryptionKeyFactoryInterface; use EonX\EasyEncryption\Common\Resolver\EncryptionKeyResolverInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use ParagonIE\Halite\EncryptionKeyPair; use ParagonIE\Halite\Symmetric\EncryptionKey; use Throwable; diff --git a/packages/EasyEncryption/src/Common/Resolver/AbstractEncryptionKeyResolver.php b/packages/EasyEncryption/src/Common/Resolver/AbstractEncryptionKeyResolver.php index 4849155f7e..22de4615f4 100644 --- a/packages/EasyEncryption/src/Common/Resolver/AbstractEncryptionKeyResolver.php +++ b/packages/EasyEncryption/src/Common/Resolver/AbstractEncryptionKeyResolver.php @@ -4,7 +4,7 @@ namespace EonX\EasyEncryption\Common\Resolver; use EonX\EasyEncryption\Common\Exception\CouldNotResolveEncryptionKeyException; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; use ParagonIE\Halite\EncryptionKeyPair; use ParagonIE\Halite\Symmetric\EncryptionKey; diff --git a/packages/EasyEncryption/src/Common/Resolver/EncryptionKeyResolverInterface.php b/packages/EasyEncryption/src/Common/Resolver/EncryptionKeyResolverInterface.php index 91b11bb371..a790fa9e8d 100644 --- a/packages/EasyEncryption/src/Common/Resolver/EncryptionKeyResolverInterface.php +++ b/packages/EasyEncryption/src/Common/Resolver/EncryptionKeyResolverInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyEncryption\Common\Resolver; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; use ParagonIE\Halite\EncryptionKeyPair; use ParagonIE\Halite\Symmetric\EncryptionKey; diff --git a/packages/EasyErrorHandler/src/Builders/AbstractErrorResponseBuilder.php b/packages/EasyErrorHandler/src/Builders/AbstractErrorResponseBuilder.php index 6a81fdd440..27598fd8a9 100644 --- a/packages/EasyErrorHandler/src/Builders/AbstractErrorResponseBuilder.php +++ b/packages/EasyErrorHandler/src/Builders/AbstractErrorResponseBuilder.php @@ -4,7 +4,7 @@ namespace EonX\EasyErrorHandler\Builders; use EonX\EasyErrorHandler\Interfaces\ErrorResponseBuilderInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; use Throwable; abstract class AbstractErrorResponseBuilder implements ErrorResponseBuilderInterface diff --git a/packages/EasyErrorHandler/src/ErrorDetailsResolver.php b/packages/EasyErrorHandler/src/ErrorDetailsResolver.php index 3d83adb2c1..702a94faa6 100644 --- a/packages/EasyErrorHandler/src/ErrorDetailsResolver.php +++ b/packages/EasyErrorHandler/src/ErrorDetailsResolver.php @@ -9,7 +9,7 @@ use EonX\EasyErrorHandler\Interfaces\Exceptions\TranslatableExceptionInterface; use EonX\EasyErrorHandler\Interfaces\Exceptions\ValidationExceptionInterface; use EonX\EasyErrorHandler\Interfaces\TranslatorInterface; -use EonX\EasyUtils\Helpers\ErrorDetailsHelper; +use EonX\EasyUtils\Common\Helper\ErrorDetailsHelper; use Psr\Log\LoggerInterface; use Throwable; diff --git a/packages/EasyErrorHandler/src/ErrorHandler.php b/packages/EasyErrorHandler/src/ErrorHandler.php index 21cc66cd66..26fee058dd 100644 --- a/packages/EasyErrorHandler/src/ErrorHandler.php +++ b/packages/EasyErrorHandler/src/ErrorHandler.php @@ -14,7 +14,7 @@ use EonX\EasyErrorHandler\Interfaces\FormatAwareInterface; use EonX\EasyErrorHandler\Interfaces\VerboseStrategyInterface; use EonX\EasyErrorHandler\Response\Data\ErrorResponseData; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use SplObjectStorage; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/packages/EasyErrorHandler/src/Interfaces/ErrorReporterInterface.php b/packages/EasyErrorHandler/src/Interfaces/ErrorReporterInterface.php index 7b3e56cd83..7cd590334b 100644 --- a/packages/EasyErrorHandler/src/Interfaces/ErrorReporterInterface.php +++ b/packages/EasyErrorHandler/src/Interfaces/ErrorReporterInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyErrorHandler\Interfaces; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; use Throwable; interface ErrorReporterInterface extends HasPriorityInterface diff --git a/packages/EasyErrorHandler/src/Interfaces/ErrorResponseBuilderInterface.php b/packages/EasyErrorHandler/src/Interfaces/ErrorResponseBuilderInterface.php index db46523ca2..4ae2303303 100644 --- a/packages/EasyErrorHandler/src/Interfaces/ErrorResponseBuilderInterface.php +++ b/packages/EasyErrorHandler/src/Interfaces/ErrorResponseBuilderInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyErrorHandler\Interfaces; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; use Throwable; interface ErrorResponseBuilderInterface extends HasPriorityInterface diff --git a/packages/EasyErrorHandler/src/Interfaces/VerboseStrategyDriverInterface.php b/packages/EasyErrorHandler/src/Interfaces/VerboseStrategyDriverInterface.php index 309316b04a..4a5dd8db8e 100644 --- a/packages/EasyErrorHandler/src/Interfaces/VerboseStrategyDriverInterface.php +++ b/packages/EasyErrorHandler/src/Interfaces/VerboseStrategyDriverInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyErrorHandler\Interfaces; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; use Symfony\Component\HttpFoundation\Request; use Throwable; diff --git a/packages/EasyErrorHandler/src/Reporters/AbstractErrorReporter.php b/packages/EasyErrorHandler/src/Reporters/AbstractErrorReporter.php index 1b33d9961b..4ebb9e1745 100644 --- a/packages/EasyErrorHandler/src/Reporters/AbstractErrorReporter.php +++ b/packages/EasyErrorHandler/src/Reporters/AbstractErrorReporter.php @@ -5,7 +5,7 @@ use EonX\EasyErrorHandler\Interfaces\ErrorLogLevelResolverInterface; use EonX\EasyErrorHandler\Interfaces\ErrorReporterInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractErrorReporter implements ErrorReporterInterface { diff --git a/packages/EasyErrorHandler/src/Verbose/AbstractVerboseStrategyDriver.php b/packages/EasyErrorHandler/src/Verbose/AbstractVerboseStrategyDriver.php index 21f3d88520..89a1a5924f 100644 --- a/packages/EasyErrorHandler/src/Verbose/AbstractVerboseStrategyDriver.php +++ b/packages/EasyErrorHandler/src/Verbose/AbstractVerboseStrategyDriver.php @@ -4,7 +4,7 @@ namespace EonX\EasyErrorHandler\Verbose; use EonX\EasyErrorHandler\Interfaces\VerboseStrategyDriverInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractVerboseStrategyDriver implements VerboseStrategyDriverInterface { diff --git a/packages/EasyErrorHandler/src/Verbose/ChainVerboseStrategy.php b/packages/EasyErrorHandler/src/Verbose/ChainVerboseStrategy.php index 68d4b7cb40..78be19b6e1 100644 --- a/packages/EasyErrorHandler/src/Verbose/ChainVerboseStrategy.php +++ b/packages/EasyErrorHandler/src/Verbose/ChainVerboseStrategy.php @@ -5,7 +5,7 @@ use EonX\EasyErrorHandler\Interfaces\VerboseStrategyDriverInterface; use EonX\EasyErrorHandler\Interfaces\VerboseStrategyInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpFoundation\Request; use Throwable; diff --git a/packages/EasyHttpClient/src/Common/HttpClient/WithEventsHttpClient.php b/packages/EasyHttpClient/src/Common/HttpClient/WithEventsHttpClient.php index f6ea7f6716..5d76341302 100644 --- a/packages/EasyHttpClient/src/Common/HttpClient/WithEventsHttpClient.php +++ b/packages/EasyHttpClient/src/Common/HttpClient/WithEventsHttpClient.php @@ -14,7 +14,7 @@ use EonX\EasyHttpClient\Common\ValueObject\RequestDataInterface; use EonX\EasyHttpClient\Common\ValueObject\ResponseData; use EonX\EasyHttpClient\Common\ValueObject\ResponseDataInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpClient\AsyncDecoratorTrait; use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpClient\Response\AsyncContext; diff --git a/packages/EasyLogging/src/Bridge/EasyUtils/SensitiveDataSanitizerProcessor.php b/packages/EasyLogging/src/Bridge/EasyUtils/SensitiveDataSanitizerProcessor.php index 4e6586fac4..536bd525f6 100644 --- a/packages/EasyLogging/src/Bridge/EasyUtils/SensitiveDataSanitizerProcessor.php +++ b/packages/EasyLogging/src/Bridge/EasyUtils/SensitiveDataSanitizerProcessor.php @@ -5,7 +5,7 @@ use EonX\EasyLogging\Config\AbstractSelfProcessorConfigProvider; use EonX\EasyLogging\Interfaces\Config\ProcessorConfigInterface; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; final class SensitiveDataSanitizerProcessor extends AbstractSelfProcessorConfigProvider { diff --git a/packages/EasyLogging/src/Bridge/Laravel/EasyLoggingServiceProvider.php b/packages/EasyLogging/src/Bridge/Laravel/EasyLoggingServiceProvider.php index c73b37aa1f..037c522249 100644 --- a/packages/EasyLogging/src/Bridge/Laravel/EasyLoggingServiceProvider.php +++ b/packages/EasyLogging/src/Bridge/Laravel/EasyLoggingServiceProvider.php @@ -9,8 +9,8 @@ use EonX\EasyLogging\Config\StreamHandlerConfigProvider; use EonX\EasyLogging\Interfaces\LoggerFactoryInterface; use EonX\EasyLogging\LoggerFactory; -use EonX\EasyUtils\Helpers\CollectorHelper; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\Common\Helper\CollectorHelper; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; use Illuminate\Contracts\Container\Container; use Illuminate\Support\ServiceProvider; use Psr\Log\LoggerInterface; diff --git a/packages/EasyLogging/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php b/packages/EasyLogging/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php index 5a4e8faa93..3155ac27b4 100644 --- a/packages/EasyLogging/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php +++ b/packages/EasyLogging/src/Bridge/Symfony/DependencyInjection/Compiler/SensitiveDataSanitizerCompilerPass.php @@ -6,7 +6,7 @@ use EonX\EasyLogging\Bridge\BridgeConstantsInterface; use EonX\EasyLogging\Bridge\EasyUtils\Exceptions\EasyUtilsNotInstalledException; use EonX\EasyLogging\Bridge\EasyUtils\SensitiveDataSanitizerProcessor; -use EonX\EasyUtils\SensitiveData\SensitiveDataSanitizerInterface; +use EonX\EasyUtils\SensitiveData\Sanitizer\SensitiveDataSanitizerInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; diff --git a/packages/EasyLogging/src/Interfaces/Config/LoggingConfigInterface.php b/packages/EasyLogging/src/Interfaces/Config/LoggingConfigInterface.php index 3e69e1da94..c31596b806 100644 --- a/packages/EasyLogging/src/Interfaces/Config/LoggingConfigInterface.php +++ b/packages/EasyLogging/src/Interfaces/Config/LoggingConfigInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyLogging\Interfaces\Config; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface LoggingConfigInterface extends HasPriorityInterface { diff --git a/packages/EasyLogging/src/LoggerFactory.php b/packages/EasyLogging/src/LoggerFactory.php index 27765c484e..d1ebaa570a 100644 --- a/packages/EasyLogging/src/LoggerFactory.php +++ b/packages/EasyLogging/src/LoggerFactory.php @@ -10,7 +10,7 @@ use EonX\EasyLogging\Interfaces\Config\ProcessorConfigProviderInterface; use EonX\EasyLogging\Interfaces\LazyLoggerFactoryInterface; use EonX\EasyLogging\Interfaces\LoggerFactoryInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Monolog\Handler\HandlerInterface; use Monolog\Handler\NullHandler; use Monolog\Logger; diff --git a/packages/EasyLogging/tests/Bridge/Symfony/Stubs/KernelStub.php b/packages/EasyLogging/tests/Bridge/Symfony/Stubs/KernelStub.php index dc221c3454..74c5278ecd 100644 --- a/packages/EasyLogging/tests/Bridge/Symfony/Stubs/KernelStub.php +++ b/packages/EasyLogging/tests/Bridge/Symfony/Stubs/KernelStub.php @@ -4,7 +4,7 @@ namespace EonX\EasyLogging\Tests\Bridge\Symfony\Stubs; use EonX\EasyLogging\Bridge\Symfony\EasyLoggingSymfonyBundle; -use EonX\EasyUtils\Bridge\Symfony\EasyUtilsSymfonyBundle; +use EonX\EasyUtils\Bundle\EasyUtilsBundle; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -44,7 +44,7 @@ public function process(ContainerBuilder $container): void public function registerBundles(): iterable { yield new EasyLoggingSymfonyBundle(); - yield new EasyUtilsSymfonyBundle(); + yield new EasyUtilsBundle(); } /** diff --git a/packages/EasyNotification/src/Client/NotificationClient.php b/packages/EasyNotification/src/Client/NotificationClient.php index 2d7fb74456..787d66f3dc 100644 --- a/packages/EasyNotification/src/Client/NotificationClient.php +++ b/packages/EasyNotification/src/Client/NotificationClient.php @@ -12,7 +12,7 @@ use EonX\EasyNotification\Message\QueueMessage; use EonX\EasyNotification\Message\RealTimeMessage; use EonX\EasyNotification\ValueObject\ConfigInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpClient\HttpClient; use Symfony\Contracts\HttpClient\HttpClientInterface; use Throwable; diff --git a/packages/EasyNotification/src/Configurator/AbstractQueueMessageConfigurator.php b/packages/EasyNotification/src/Configurator/AbstractQueueMessageConfigurator.php index 56a223d804..98b63dc7b2 100644 --- a/packages/EasyNotification/src/Configurator/AbstractQueueMessageConfigurator.php +++ b/packages/EasyNotification/src/Configurator/AbstractQueueMessageConfigurator.php @@ -3,7 +3,7 @@ namespace EonX\EasyNotification\Configurator; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractQueueMessageConfigurator implements QueueMessageConfiguratorInterface { diff --git a/packages/EasyNotification/src/Configurator/QueueMessageConfiguratorInterface.php b/packages/EasyNotification/src/Configurator/QueueMessageConfiguratorInterface.php index 17569a6031..2dbb9a9745 100644 --- a/packages/EasyNotification/src/Configurator/QueueMessageConfiguratorInterface.php +++ b/packages/EasyNotification/src/Configurator/QueueMessageConfiguratorInterface.php @@ -6,7 +6,7 @@ use EonX\EasyNotification\Message\MessageInterface; use EonX\EasyNotification\Message\QueueMessageInterface; use EonX\EasyNotification\ValueObject\ConfigInterface; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface QueueMessageConfiguratorInterface extends HasPriorityInterface { diff --git a/packages/EasyPagination/src/Paginators/IterableLengthAwarePaginator.php b/packages/EasyPagination/src/Paginators/IterableLengthAwarePaginator.php index 2d491e6aa8..cd2c1288df 100644 --- a/packages/EasyPagination/src/Paginators/IterableLengthAwarePaginator.php +++ b/packages/EasyPagination/src/Paginators/IterableLengthAwarePaginator.php @@ -4,7 +4,7 @@ namespace EonX\EasyPagination\Paginators; use EonX\EasyPagination\Interfaces\PaginationInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class IterableLengthAwarePaginator extends AbstractLengthAwarePaginator { diff --git a/packages/EasyPagination/src/Paginators/IterablePaginator.php b/packages/EasyPagination/src/Paginators/IterablePaginator.php index 3ced11fe6c..1679e43cfa 100644 --- a/packages/EasyPagination/src/Paginators/IterablePaginator.php +++ b/packages/EasyPagination/src/Paginators/IterablePaginator.php @@ -4,7 +4,7 @@ namespace EonX\EasyPagination\Paginators; use EonX\EasyPagination\Interfaces\PaginationInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class IterablePaginator extends AbstractPaginator { diff --git a/packages/EasySecurity/src/Authorization/Factory/AuthorizationMatrixFactory.php b/packages/EasySecurity/src/Authorization/Factory/AuthorizationMatrixFactory.php index f184cd3120..5e0a030cf5 100644 --- a/packages/EasySecurity/src/Authorization/Factory/AuthorizationMatrixFactory.php +++ b/packages/EasySecurity/src/Authorization/Factory/AuthorizationMatrixFactory.php @@ -7,7 +7,7 @@ use EonX\EasySecurity\Authorization\Provider\AuthorizationMatrixProviderInterface; use EonX\EasySecurity\Authorization\Provider\PermissionsProviderInterface; use EonX\EasySecurity\Authorization\Provider\RolesProviderInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class AuthorizationMatrixFactory implements AuthorizationMatrixFactoryInterface { diff --git a/packages/EasySecurity/src/Common/Configurator/AbstractSecurityContextConfigurator.php b/packages/EasySecurity/src/Common/Configurator/AbstractSecurityContextConfigurator.php index 993e790b45..4ff483d19a 100644 --- a/packages/EasySecurity/src/Common/Configurator/AbstractSecurityContextConfigurator.php +++ b/packages/EasySecurity/src/Common/Configurator/AbstractSecurityContextConfigurator.php @@ -3,7 +3,7 @@ namespace EonX\EasySecurity\Common\Configurator; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractSecurityContextConfigurator implements SecurityContextConfiguratorInterface { diff --git a/packages/EasySecurity/src/Common/Configurator/FromRequestConfigurator.php b/packages/EasySecurity/src/Common/Configurator/FromRequestConfigurator.php index ef409321da..1716d0b55a 100644 --- a/packages/EasySecurity/src/Common/Configurator/FromRequestConfigurator.php +++ b/packages/EasySecurity/src/Common/Configurator/FromRequestConfigurator.php @@ -4,7 +4,7 @@ namespace EonX\EasySecurity\Common\Configurator; use EonX\EasySecurity\Common\Context\SecurityContextInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpFoundation\Request; final class FromRequestConfigurator diff --git a/packages/EasySecurity/src/Common/Configurator/SecurityContextConfiguratorInterface.php b/packages/EasySecurity/src/Common/Configurator/SecurityContextConfiguratorInterface.php index 07c33890ae..b65401b74c 100644 --- a/packages/EasySecurity/src/Common/Configurator/SecurityContextConfiguratorInterface.php +++ b/packages/EasySecurity/src/Common/Configurator/SecurityContextConfiguratorInterface.php @@ -4,7 +4,7 @@ namespace EonX\EasySecurity\Common\Configurator; use EonX\EasySecurity\Common\Context\SecurityContextInterface; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; use Symfony\Component\HttpFoundation\Request; interface SecurityContextConfiguratorInterface extends HasPriorityInterface diff --git a/packages/EasySecurity/src/Common/DataCollector/SecurityContextDataCollector.php b/packages/EasySecurity/src/Common/DataCollector/SecurityContextDataCollector.php index 44e69f5570..c3d02b1bbb 100644 --- a/packages/EasySecurity/src/Common/DataCollector/SecurityContextDataCollector.php +++ b/packages/EasySecurity/src/Common/DataCollector/SecurityContextDataCollector.php @@ -12,7 +12,7 @@ use EonX\EasySecurity\Common\Entity\ProviderInterface; use EonX\EasySecurity\Common\Entity\UserInterface; use EonX\EasySecurity\Common\Resolver\SecurityContextResolverInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use ReflectionClass; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/packages/EasySecurity/src/EasyBugsnag/Configurator/SecurityContextClientConfigurator.php b/packages/EasySecurity/src/EasyBugsnag/Configurator/SecurityContextClientConfigurator.php index 84b6ed1bc2..d145612de1 100644 --- a/packages/EasySecurity/src/EasyBugsnag/Configurator/SecurityContextClientConfigurator.php +++ b/packages/EasySecurity/src/EasyBugsnag/Configurator/SecurityContextClientConfigurator.php @@ -13,7 +13,7 @@ use EonX\EasySecurity\Common\Entity\ProviderInterface; use EonX\EasySecurity\Common\Entity\UserInterface; use EonX\EasySecurity\Common\Resolver\SecurityContextResolverInterface; -use EonX\EasyUtils\Helpers\ErrorDetailsHelper; +use EonX\EasyUtils\Common\Helper\ErrorDetailsHelper; use Throwable; final class SecurityContextClientConfigurator extends AbstractClientConfigurator diff --git a/packages/EasySecurity/tests/Stub/Provider/ApiTokenDecoderProviderStub.php b/packages/EasySecurity/tests/Stub/Provider/ApiTokenDecoderProviderStub.php index 3ffa6f7c7a..4c41244921 100644 --- a/packages/EasySecurity/tests/Stub/Provider/ApiTokenDecoderProviderStub.php +++ b/packages/EasySecurity/tests/Stub/Provider/ApiTokenDecoderProviderStub.php @@ -5,7 +5,7 @@ use EonX\EasyApiToken\Common\Decoder\BasicAuthDecoder; use EonX\EasyApiToken\Common\Provider\DecoderProviderInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; final class ApiTokenDecoderProviderStub implements DecoderProviderInterface { diff --git a/packages/EasySwoole/src/Common/Checker/AbstractAppStateChecker.php b/packages/EasySwoole/src/Common/Checker/AbstractAppStateChecker.php index 18c95f0bf3..4dc6bdcf52 100644 --- a/packages/EasySwoole/src/Common/Checker/AbstractAppStateChecker.php +++ b/packages/EasySwoole/src/Common/Checker/AbstractAppStateChecker.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Checker; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractAppStateChecker implements AppStateCheckerInterface { diff --git a/packages/EasySwoole/src/Common/Checker/AppStateCheckerInterface.php b/packages/EasySwoole/src/Common/Checker/AppStateCheckerInterface.php index 6641fdcc63..3860ffb978 100644 --- a/packages/EasySwoole/src/Common/Checker/AppStateCheckerInterface.php +++ b/packages/EasySwoole/src/Common/Checker/AppStateCheckerInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Checker; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface AppStateCheckerInterface extends HasPriorityInterface { diff --git a/packages/EasySwoole/src/Common/Helper/EnvVarHelper.php b/packages/EasySwoole/src/Common/Helper/EnvVarHelper.php index 30dea050cf..bdd9d8f822 100644 --- a/packages/EasySwoole/src/Common/Helper/EnvVarHelper.php +++ b/packages/EasySwoole/src/Common/Helper/EnvVarHelper.php @@ -4,7 +4,7 @@ namespace EonX\EasySwoole\Common\Helper; use EonX\EasySwoole\Logging\Helper\OutputHelper; -use EonX\EasyUtils\Helpers\EnvVarSubstitutionHelper; +use EonX\EasyUtils\Common\Helper\EnvVarSubstitutionHelper; use function Symfony\Component\String\u; diff --git a/packages/EasySwoole/src/Common/Helper/ErrorResponseHelper.php b/packages/EasySwoole/src/Common/Helper/ErrorResponseHelper.php index b218b1bd17..c8befd68d2 100644 --- a/packages/EasySwoole/src/Common/Helper/ErrorResponseHelper.php +++ b/packages/EasySwoole/src/Common/Helper/ErrorResponseHelper.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Helper; -use EonX\EasyUtils\Helpers\ErrorDetailsHelper; +use EonX\EasyUtils\Common\Helper\ErrorDetailsHelper; use Swoole\Http\Response; use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse; use Throwable; diff --git a/packages/EasySwoole/src/Common/Initializer/AbstractAppStateInitializer.php b/packages/EasySwoole/src/Common/Initializer/AbstractAppStateInitializer.php index e84dea714a..434621bb80 100644 --- a/packages/EasySwoole/src/Common/Initializer/AbstractAppStateInitializer.php +++ b/packages/EasySwoole/src/Common/Initializer/AbstractAppStateInitializer.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Initializer; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractAppStateInitializer implements AppStateInitializerInterface { diff --git a/packages/EasySwoole/src/Common/Initializer/AppStateInitializerInterface.php b/packages/EasySwoole/src/Common/Initializer/AppStateInitializerInterface.php index fc6fcf150c..e67c8c24cb 100644 --- a/packages/EasySwoole/src/Common/Initializer/AppStateInitializerInterface.php +++ b/packages/EasySwoole/src/Common/Initializer/AppStateInitializerInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Initializer; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface AppStateInitializerInterface extends HasPriorityInterface { diff --git a/packages/EasySwoole/src/Common/Listener/ApplicationStateCheckListener.php b/packages/EasySwoole/src/Common/Listener/ApplicationStateCheckListener.php index 42297ef183..e3cc5b5610 100644 --- a/packages/EasySwoole/src/Common/Listener/ApplicationStateCheckListener.php +++ b/packages/EasySwoole/src/Common/Listener/ApplicationStateCheckListener.php @@ -5,7 +5,7 @@ use EonX\EasySwoole\Common\Checker\AppStateCheckerInterface; use EonX\EasySwoole\Common\Enum\RequestAttribute; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\TerminateEvent; diff --git a/packages/EasySwoole/src/Common/Listener/ApplicationStateInitListener.php b/packages/EasySwoole/src/Common/Listener/ApplicationStateInitListener.php index cb746379cf..df83ea4705 100644 --- a/packages/EasySwoole/src/Common/Listener/ApplicationStateInitListener.php +++ b/packages/EasySwoole/src/Common/Listener/ApplicationStateInitListener.php @@ -4,7 +4,7 @@ namespace EonX\EasySwoole\Common\Listener; use EonX\EasySwoole\Common\Initializer\AppStateInitializerInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpKernel\Event\RequestEvent; final class ApplicationStateInitListener extends AbstractRequestListener diff --git a/packages/EasySwoole/src/Common/Listener/ApplicationStateResetListener.php b/packages/EasySwoole/src/Common/Listener/ApplicationStateResetListener.php index 74ed44ac8b..76f58858a7 100644 --- a/packages/EasySwoole/src/Common/Listener/ApplicationStateResetListener.php +++ b/packages/EasySwoole/src/Common/Listener/ApplicationStateResetListener.php @@ -4,7 +4,7 @@ namespace EonX\EasySwoole\Common\Listener; use EonX\EasySwoole\Common\Resetter\AppStateResetterInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\HttpKernel\Event\TerminateEvent; final class ApplicationStateResetListener extends AbstractTerminateListener diff --git a/packages/EasySwoole/src/Common/Resetter/AbstractAppStateResetter.php b/packages/EasySwoole/src/Common/Resetter/AbstractAppStateResetter.php index f3808a6aee..04f6c26a59 100644 --- a/packages/EasySwoole/src/Common/Resetter/AbstractAppStateResetter.php +++ b/packages/EasySwoole/src/Common/Resetter/AbstractAppStateResetter.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Resetter; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractAppStateResetter implements AppStateResetterInterface { diff --git a/packages/EasySwoole/src/Common/Resetter/AppStateResetterInterface.php b/packages/EasySwoole/src/Common/Resetter/AppStateResetterInterface.php index e0e58156bc..c8484faa5a 100644 --- a/packages/EasySwoole/src/Common/Resetter/AppStateResetterInterface.php +++ b/packages/EasySwoole/src/Common/Resetter/AppStateResetterInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Resetter; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface AppStateResetterInterface extends HasPriorityInterface { diff --git a/packages/EasySwoole/src/Common/Resetter/SymfonyServicesAppStateResetter.php b/packages/EasySwoole/src/Common/Resetter/SymfonyServicesAppStateResetter.php index e118fa5ed0..a23c2845c7 100644 --- a/packages/EasySwoole/src/Common/Resetter/SymfonyServicesAppStateResetter.php +++ b/packages/EasySwoole/src/Common/Resetter/SymfonyServicesAppStateResetter.php @@ -3,7 +3,7 @@ namespace EonX\EasySwoole\Common\Resetter; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; use Traversable; diff --git a/packages/EasySwoole/tests/Unit/bundle/ConfigurationTest.php b/packages/EasySwoole/tests/Unit/bundle/ConfigurationTest.php index 884e0fb022..d13e5cf5f8 100644 --- a/packages/EasySwoole/tests/Unit/bundle/ConfigurationTest.php +++ b/packages/EasySwoole/tests/Unit/bundle/ConfigurationTest.php @@ -4,7 +4,7 @@ namespace EonX\EasySwoole\Tests\Unit\Bundle; use EonX\EasySwoole\Bundle\EasySwooleBundle; -use EonX\EasyUtils\Helpers\ArrayHelper; +use EonX\EasyUtils\Common\Helper\ArrayHelper; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Config\Definition\Configuration; use Symfony\Component\Config\Definition\Processor; diff --git a/packages/EasyTemplatingBlock/src/Common/Renderer/AbstractSimpleTemplatingBlockRenderer.php b/packages/EasyTemplatingBlock/src/Common/Renderer/AbstractSimpleTemplatingBlockRenderer.php index a5995349cb..51b50907b5 100644 --- a/packages/EasyTemplatingBlock/src/Common/Renderer/AbstractSimpleTemplatingBlockRenderer.php +++ b/packages/EasyTemplatingBlock/src/Common/Renderer/AbstractSimpleTemplatingBlockRenderer.php @@ -4,7 +4,7 @@ namespace EonX\EasyTemplatingBlock\Common\Renderer; use EonX\EasyTemplatingBlock\Common\ValueObject\TemplatingBlockInterface; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractSimpleTemplatingBlockRenderer implements TemplatingBlockRendererInterface { diff --git a/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingBlockRendererInterface.php b/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingBlockRendererInterface.php index b8a3732972..abb4aad3c6 100644 --- a/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingBlockRendererInterface.php +++ b/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingBlockRendererInterface.php @@ -4,7 +4,7 @@ namespace EonX\EasyTemplatingBlock\Common\Renderer; use EonX\EasyTemplatingBlock\Common\ValueObject\TemplatingBlockInterface; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface TemplatingBlockRendererInterface extends HasPriorityInterface { diff --git a/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingEventRenderer.php b/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingEventRenderer.php index c5b96f6b81..cd7955fce1 100644 --- a/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingEventRenderer.php +++ b/packages/EasyTemplatingBlock/src/Common/Renderer/TemplatingEventRenderer.php @@ -6,7 +6,7 @@ use EonX\EasyTemplatingBlock\Common\Exception\NoRendererFoundForBlockException; use EonX\EasyTemplatingBlock\Common\Provider\TemplatingBlockProviderInterface; use EonX\EasyTemplatingBlock\Common\ValueObject\TemplatingBlockInterface; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; final class TemplatingEventRenderer implements TemplatingEventRendererInterface { diff --git a/packages/EasyTemplatingBlock/src/Common/ValueObject/AbstractTemplatingBlock.php b/packages/EasyTemplatingBlock/src/Common/ValueObject/AbstractTemplatingBlock.php index 5fa20c3911..d8ee8720a3 100644 --- a/packages/EasyTemplatingBlock/src/Common/ValueObject/AbstractTemplatingBlock.php +++ b/packages/EasyTemplatingBlock/src/Common/ValueObject/AbstractTemplatingBlock.php @@ -3,7 +3,7 @@ namespace EonX\EasyTemplatingBlock\Common\ValueObject; -use EonX\EasyUtils\Traits\HasPriorityTrait; +use EonX\EasyUtils\Common\Helper\HasPriorityTrait; abstract class AbstractTemplatingBlock implements TemplatingBlockInterface { diff --git a/packages/EasyTemplatingBlock/src/Common/ValueObject/TemplatingBlockInterface.php b/packages/EasyTemplatingBlock/src/Common/ValueObject/TemplatingBlockInterface.php index 8911d4b43c..55d7088836 100644 --- a/packages/EasyTemplatingBlock/src/Common/ValueObject/TemplatingBlockInterface.php +++ b/packages/EasyTemplatingBlock/src/Common/ValueObject/TemplatingBlockInterface.php @@ -3,7 +3,7 @@ namespace EonX\EasyTemplatingBlock\Common\ValueObject; -use EonX\EasyUtils\Interfaces\HasPriorityInterface; +use EonX\EasyUtils\Common\Helper\HasPriorityInterface; interface TemplatingBlockInterface extends HasPriorityInterface { diff --git a/packages/EasyTest/src/Coverage/Application/EasyTestApplication.php b/packages/EasyTest/src/Coverage/Application/EasyTestApplication.php index c0e8daaad4..8ec4d82e01 100644 --- a/packages/EasyTest/src/Coverage/Application/EasyTestApplication.php +++ b/packages/EasyTest/src/Coverage/Application/EasyTestApplication.php @@ -3,7 +3,7 @@ namespace EonX\EasyTest\Coverage\Application; -use EonX\EasyUtils\Helpers\CollectorHelper; +use EonX\EasyUtils\Common\Helper\CollectorHelper; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; diff --git a/packages/EasyTest/src/InvalidData/Maker/InvalidDataMaker.php b/packages/EasyTest/src/InvalidData/Maker/InvalidDataMaker.php index 81d182a59a..59093e14f1 100644 --- a/packages/EasyTest/src/InvalidData/Maker/InvalidDataMaker.php +++ b/packages/EasyTest/src/InvalidData/Maker/InvalidDataMaker.php @@ -5,10 +5,10 @@ use Carbon\Carbon; use Doctrine\Common\Collections\ArrayCollection; -use EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Alphanumeric; -use EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\AlphanumericHyphen; -use EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\DateInterval; -use EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Decimal; +use EonX\EasyUtils\Common\Constraint\Alphanumeric; +use EonX\EasyUtils\Common\Constraint\AlphanumericHyphen; +use EonX\EasyUtils\Common\Constraint\DateInterval; +use EonX\EasyUtils\Common\Constraint\Decimal; use Symfony\Component\Validator\Constraints\CardScheme; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Constraints\Count; diff --git a/packages/EasyUtils/bundle/EasyUtilsBundle.php b/packages/EasyUtils/bundle/EasyUtilsBundle.php new file mode 100644 index 0000000000..959a9af8bf --- /dev/null +++ b/packages/EasyUtils/bundle/EasyUtilsBundle.php @@ -0,0 +1,137 @@ + ConfigParam::MathFormatDecimalSeparator, + 'format_thousands_separator' => ConfigParam::MathFormatThousandsSeparator, + 'round_mode' => ConfigParam::MathRoundMode, + 'round_precision' => ConfigParam::MathRoundPrecision, + 'scale' => ConfigParam::MathScale, + ]; + + public const SENSITIVE_DATA_DEFAULT_KEYS_TO_MASK = [ + 'access_key', + 'access_secret', + 'access_token', + 'apikey', + 'auth_basic', + 'auth_bearer', + 'authorization', + 'card_number', + 'cert', + 'cvc', + 'cvv', + 'number', + 'password', + 'php-auth-pw', + 'php_auth_pw', + 'php-auth-user', + 'php_auth_user', + 'securitycode', + 'token', + 'verificationcode', + 'x-shared-key', + '40309', // Value of the CURLOPT_CAINFO_BLOB constant + '40291', // Value of the CURLOPT_SSLCERT_BLOB constant + '40292', // Value of the CURLOPT_SSLKEY_BLOB constant + ]; + + private const STRING_TRIMMER_CONFIG = [ + 'except_keys' => ConfigParam::StringTrimmerExceptKeys, + ]; + + public function __construct() + { + $this->path = \realpath(__DIR__); + } + + public function configure(DefinitionConfigurator $definition): void + { + $definition->import('config/definition.php'); + } + + public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void + { + foreach (self::MATH_CONFIG as $name => $param) { + $container + ->parameters() + ->set($param->value, $config['math'][$name]); + } + + foreach (self::STRING_TRIMMER_CONFIG as $name => $param) { + $container + ->parameters() + ->set($param->value, $config['string_trimmer'][$name]); + } + + $container->import('config/services.php'); + + // SensitiveData + if ($config['sensitive_data']['enabled'] ?? true) { + $this->configureSensitiveDataSanitizer($config, $container, $builder); + } + + // StringTrimmer + if ($config['string_trimmer']['enabled'] ?? false) { + $container->import('config/string_trimmer.php'); + } + } + + private function configureSensitiveDataSanitizer( + array $config, + ContainerConfigurator $container, + ContainerBuilder $builder, + ): void { + $builder + ->registerForAutoconfiguration(ObjectTransformerInterface::class) + ->addTag(ConfigTag::SensitiveDataObjectTransformer->value); + + $builder + ->registerForAutoconfiguration(StringSanitizerInterface::class) + ->addTag(ConfigTag::SensitiveDataStringSanitizer->value); + + if ($config['sensitive_data']['use_default_object_transformers'] ?? true) { + $container->import('config/sensitive_data_default_object_transformers.php'); + } + + if ($config['sensitive_data']['use_default_string_sanitizers'] ?? true) { + $container->import('config/sensitive_data_default_string_sanitizers.php'); + } + + $container->import('config/sensitive_data.php'); + + $defaultKeysToMask = ($config['sensitive_data']['use_default_keys_to_mask'] ?? true) + ? self::SENSITIVE_DATA_DEFAULT_KEYS_TO_MASK + : []; + + $keysToMask = $config['sensitive_data']['keys_to_mask'] ?? []; + + $container + ->parameters() + ->set( + ConfigParam::SensitiveDataKeysToMask->value, + \array_unique(\array_merge($defaultKeysToMask, $keysToMask)) + ); + + $container + ->parameters() + ->set( + ConfigParam::SensitiveDataMaskPattern->value, + $config['sensitive_data']['mask_pattern'] ?? BundleParam::SensitiveDataDefaultMaskPattern->value + ); + } +} diff --git a/packages/EasyUtils/bundle/Enum/BundleParam.php b/packages/EasyUtils/bundle/Enum/BundleParam.php new file mode 100644 index 0000000000..1befadea9c --- /dev/null +++ b/packages/EasyUtils/bundle/Enum/BundleParam.php @@ -0,0 +1,9 @@ +services(); + $services->defaults() + ->autowire() + ->autoconfigure(); + + $services + ->set(SensitiveDataSanitizerInterface::class, SensitiveDataSanitizer::class) + ->arg('$keysToMask', param(ConfigParam::SensitiveDataKeysToMask->value)) + ->arg('$maskPattern', param(ConfigParam::SensitiveDataMaskPattern->value)) + ->arg('$objectTransformers', tagged_iterator(ConfigTag::SensitiveDataObjectTransformer->value)) + ->arg('$stringSanitizers', tagged_iterator(ConfigTag::SensitiveDataStringSanitizer->value)); +}; diff --git a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_object_transformers.php b/packages/EasyUtils/bundle/config/sensitive_data_default_object_transformers.php similarity index 76% rename from packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_object_transformers.php rename to packages/EasyUtils/bundle/config/sensitive_data_default_object_transformers.php index 9ded135f34..379b94b4ea 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_object_transformers.php +++ b/packages/EasyUtils/bundle/config/sensitive_data_default_object_transformers.php @@ -3,8 +3,8 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; -use EonX\EasyUtils\SensitiveData\ObjectTransformers\DefaultObjectTransformer; -use EonX\EasyUtils\SensitiveData\ObjectTransformers\ThrowableObjectTransformer; +use EonX\EasyUtils\SensitiveData\Transformer\DefaultObjectTransformer; +use EonX\EasyUtils\SensitiveData\Transformer\ThrowableObjectTransformer; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); diff --git a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_string_sanitizers.php b/packages/EasyUtils/bundle/config/sensitive_data_default_string_sanitizers.php similarity index 67% rename from packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_string_sanitizers.php rename to packages/EasyUtils/bundle/config/sensitive_data_default_string_sanitizers.php index d39528777d..66e2d7e3f8 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data_default_string_sanitizers.php +++ b/packages/EasyUtils/bundle/config/sensitive_data_default_string_sanitizers.php @@ -3,10 +3,10 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; -use EonX\EasyUtils\SensitiveData\StringSanitizers\AuthorizationStringSanitizer; -use EonX\EasyUtils\SensitiveData\StringSanitizers\CreditCardNumberStringSanitizer; -use EonX\EasyUtils\SensitiveData\StringSanitizers\JsonStringSanitizer; -use EonX\EasyUtils\SensitiveData\StringSanitizers\UrlStringSanitizer; +use EonX\EasyUtils\SensitiveData\Sanitizer\AuthorizationStringSanitizer; +use EonX\EasyUtils\SensitiveData\Sanitizer\CreditCardNumberStringSanitizer; +use EonX\EasyUtils\SensitiveData\Sanitizer\JsonStringSanitizer; +use EonX\EasyUtils\SensitiveData\Sanitizer\UrlStringSanitizer; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); diff --git a/packages/EasyUtils/bundle/config/services.php b/packages/EasyUtils/bundle/config/services.php new file mode 100644 index 0000000000..ea3b1fd504 --- /dev/null +++ b/packages/EasyUtils/bundle/config/services.php @@ -0,0 +1,31 @@ +services(); + $services->defaults() + ->autowire() + ->autoconfigure(); + + $services->set(CreditCardNumberValidatorInterface::class, CreditCardNumberValidator::class); + $services->set(CsvWithHeadersParserInterface::class, CsvWithHeadersParser::class); + $services->set(ForBuildEnvVarProcessor::class); + + $services->set(MathHelperInterface::class, MathHelper::class) + ->arg('$roundPrecision', param(ConfigParam::MathRoundPrecision->value)) + ->arg('$roundMode', param(ConfigParam::MathRoundMode->value)) + ->arg('$scale', param(ConfigParam::MathScale->value)) + ->arg('$decimalSeparator', param(ConfigParam::MathFormatDecimalSeparator->value)) + ->arg('$thousandsSeparator', param(ConfigParam::MathFormatThousandsSeparator->value)); +}; diff --git a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/string_trimmer.php b/packages/EasyUtils/bundle/config/string_trimmer.php similarity index 57% rename from packages/EasyUtils/src/Bridge/Symfony/Resources/config/string_trimmer.php rename to packages/EasyUtils/bundle/config/string_trimmer.php index ec03b102d3..ceabb18f5a 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/string_trimmer.php +++ b/packages/EasyUtils/bundle/config/string_trimmer.php @@ -3,10 +3,10 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; -use EonX\EasyUtils\Bridge\BridgeConstantsInterface; -use EonX\EasyUtils\Bridge\Symfony\Normalizers\TrimStringsNormalizer; -use EonX\EasyUtils\StringTrimmers\RecursiveStringTrimmer; -use EonX\EasyUtils\StringTrimmers\StringTrimmerInterface; +use EonX\EasyUtils\Bundle\Enum\ConfigParam; +use EonX\EasyUtils\Common\Normalizer\TrimStringsNormalizer; +use EonX\EasyUtils\Common\Trimmer\RecursiveStringTrimmer; +use EonX\EasyUtils\Common\Trimmer\StringTrimmerInterface; return static function (ContainerConfigurator $container): void { $services = $container->services(); @@ -18,6 +18,6 @@ $services->set(StringTrimmerInterface::class, RecursiveStringTrimmer::class); $services->set(TrimStringsNormalizer::class) - ->arg('$exceptKeys', '%' . BridgeConstantsInterface::PARAM_STRING_TRIMMER_EXCEPT_KEYS . '%') + ->arg('$exceptKeys', param(ConfigParam::StringTrimmerExceptKeys->value)) ->tag('serializer.normalizer'); }; diff --git a/packages/EasyUtils/composer.json b/packages/EasyUtils/composer.json index 08ee275a35..9390f2afd6 100644 --- a/packages/EasyUtils/composer.json +++ b/packages/EasyUtils/composer.json @@ -4,26 +4,44 @@ "type": "library", "license": "MIT", "require": { - "php": "^8.2" + "php": "^8.2", + "ext-bcmath": "*", + "ext-ctype": "*", + "ext-filter": "*", + "symfony/config": "^6.4", + "symfony/dependency-injection": "^6.4", + "symfony/http-kernel": "^6.4" }, "require-dev": { "eonx-com/easy-test": "^5.12", "laravel/lumen-framework": "^9.1", "mockery/mockery": "^1.6", "phpunit/phpunit": "^10.2", - "symfony/symfony": "^6.4" + "symfony/serializer": "^6.4", + "symfony/validator": "^6.4" }, "autoload": { "psr-4": { "EonX\\EasyUtils\\": "src", - "EonX\\EasyUtils\\Bridge\\Symfony\\": "src/Bridge/Symfony" + "EonX\\EasyUtils\\Bundle\\": "bundle", + "EonX\\EasyUtils\\Laravel\\": "laravel" } }, "autoload-dev": { "psr-4": { - "EonX\\EasyUtils\\Tests\\": "tests" + "EonX\\EasyUtils\\Tests\\": "tests", + "EonX\\EasyUtils\\Tests\\Unit\\": "tests/Unit/src", + "EonX\\EasyUtils\\Tests\\Unit\\Bundle\\": "tests/Unit/bundle", + "EonX\\EasyUtils\\Tests\\Unit\\Laravel\\": "tests/Unit/laravel" } }, + "suggest": { + "ext-iconv": "To support CSV parsing", + "ext-mbstring": "To support sensitive data sanitization", + "symfony/serializer": "To support string trimming", + "symfony/translation": "To use Symfony Translator integration", + "symfony/validator": "To support custom constraints" + }, "extra": { "branch-alias": { "dev-master": "5.12-dev" diff --git a/packages/EasyUtils/src/Bridge/Laravel/EasyUtilsServiceProvider.php b/packages/EasyUtils/laravel/EasyUtilsServiceProvider.php similarity index 67% rename from packages/EasyUtils/src/Bridge/Laravel/EasyUtilsServiceProvider.php rename to packages/EasyUtils/laravel/EasyUtilsServiceProvider.php index 99eb97562a..240726baf0 100644 --- a/packages/EasyUtils/src/Bridge/Laravel/EasyUtilsServiceProvider.php +++ b/packages/EasyUtils/laravel/EasyUtilsServiceProvider.php @@ -1,27 +1,29 @@ new CsvWithHeadersParser() ); - $this->app->singleton(MathInterface::class, static fn (): MathInterface => new Math( + $this->app->singleton(MathHelperInterface::class, static fn (): MathHelperInterface => new MathHelper( roundPrecision: \config('easy-utils.math.round-precision'), roundMode: \config('easy-utils.math.round-mode'), scale: \config('easy-utils.math.scale'), @@ -75,7 +77,7 @@ private function sensitiveData(): void ); $this->app->tag( ThrowableObjectTransformer::class, - [BridgeConstantsInterface::TAG_SENSITIVE_DATA_OBJECT_TRANSFORMER] + [ConfigTag::SensitiveDataObjectTransformer->value] ); $this->app->singleton( @@ -84,7 +86,7 @@ private function sensitiveData(): void ); $this->app->tag( DefaultObjectTransformer::class, - [BridgeConstantsInterface::TAG_SENSITIVE_DATA_OBJECT_TRANSFORMER] + [ConfigTag::SensitiveDataObjectTransformer->value] ); } @@ -96,7 +98,7 @@ private function sensitiveData(): void ) ); $this->app->tag(AuthorizationStringSanitizer::class, [ - BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER, + ConfigTag::SensitiveDataStringSanitizer->value, ]); $this->app->singleton( @@ -107,7 +109,7 @@ private function sensitiveData(): void ) ); $this->app->tag(CreditCardNumberStringSanitizer::class, [ - BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER, + ConfigTag::SensitiveDataStringSanitizer->value, ]); $this->app->singleton( @@ -117,7 +119,7 @@ private function sensitiveData(): void ) ); $this->app->tag(JsonStringSanitizer::class, [ - BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER, + ConfigTag::SensitiveDataStringSanitizer->value, ]); $this->app->singleton( @@ -127,26 +129,26 @@ private function sensitiveData(): void ) ); $this->app->tag(UrlStringSanitizer::class, [ - BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER, + ConfigTag::SensitiveDataStringSanitizer->value, ]); } $defaultKeysToMask = \config('easy-utils.sensitive_data.use_default_keys_to_mask', true) - ? BridgeConstantsInterface::SENSITIVE_DATA_DEFAULT_KEYS_TO_MASK + ? EasyUtilsBundle::SENSITIVE_DATA_DEFAULT_KEYS_TO_MASK : []; $keysToMask = \config('easy-utils.sensitive_data.keys_to_mask', []); $maskPattern = \config('easy-utils.sensitive_data.mask_pattern') - ?? BridgeConstantsInterface::SENSITIVE_DATA_DEFAULT_MASK_PATTERN; + ?? BundleParam::SensitiveDataDefaultMaskPattern->value; $this->app->singleton( SensitiveDataSanitizerInterface::class, static fn (Container $container): SensitiveDataSanitizerInterface => new SensitiveDataSanitizer( \array_unique(\array_merge($defaultKeysToMask, $keysToMask)), $maskPattern, - $container->tagged(BridgeConstantsInterface::TAG_SENSITIVE_DATA_OBJECT_TRANSFORMER), - $container->tagged(BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER) + $container->tagged(ConfigTag::SensitiveDataObjectTransformer->value), + $container->tagged(ConfigTag::SensitiveDataStringSanitizer->value) ) ); } @@ -161,12 +163,12 @@ private function stringTrimmer(): void $app = $this->app; $app->singleton(StringTrimmerInterface::class, RecursiveStringTrimmer::class); $app->singleton( - TrimStrings::class, - static fn (Container $app): TrimStrings => new TrimStrings( + TrimStringsMiddleware::class, + static fn (Container $app): TrimStringsMiddleware => new TrimStringsMiddleware( $app->get(StringTrimmerInterface::class), \config('easy-utils.string_trimmer.except_keys', []) ) ); - $app->middleware([TrimStrings::class]); + $app->middleware([TrimStringsMiddleware::class]); } } diff --git a/packages/EasyUtils/src/Bridge/Laravel/Middlewares/TrimStrings.php b/packages/EasyUtils/laravel/Middleware/TrimStringsMiddleware.php similarity index 89% rename from packages/EasyUtils/src/Bridge/Laravel/Middlewares/TrimStrings.php rename to packages/EasyUtils/laravel/Middleware/TrimStringsMiddleware.php index de5639edac..96abcaa0ea 100644 --- a/packages/EasyUtils/src/Bridge/Laravel/Middlewares/TrimStrings.php +++ b/packages/EasyUtils/laravel/Middleware/TrimStringsMiddleware.php @@ -1,14 +1,14 @@ BridgeConstantsInterface::PARAM_MATH_FORMAT_DECIMAL_SEPARATOR, - 'format_thousands_separator' => BridgeConstantsInterface::PARAM_MATH_FORMAT_THOUSANDS_SEPARATOR, - 'round_mode' => BridgeConstantsInterface::PARAM_MATH_ROUND_MODE, - 'round_precision' => BridgeConstantsInterface::PARAM_MATH_ROUND_PRECISION, - 'scale' => BridgeConstantsInterface::PARAM_MATH_SCALE, - ]; - - private const STRING_TRIMMER_CONFIG = [ - 'except_keys' => BridgeConstantsInterface::PARAM_STRING_TRIMMER_EXCEPT_KEYS, - ]; - - protected string $extensionAlias = 'easy_utils'; - - public function __construct() - { - $this->path = \realpath(__DIR__); - } - - public function configure(DefinitionConfigurator $definition): void - { - $definition->import(__DIR__ . '/Resources/config/definition.php'); - } - - public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void - { - foreach (self::MATH_CONFIG as $name => $param) { - $container - ->parameters() - ->set($param, $config['math'][$name]); - } - - foreach (self::STRING_TRIMMER_CONFIG as $name => $param) { - $container - ->parameters() - ->set($param, $config['string_trimmer'][$name]); - } - - $container->import(__DIR__ . '/Resources/config/services.php'); - - // SensitiveData - if ($config['sensitive_data']['enabled'] ?? true) { - $this->configureSensitiveDataSanitizer($config, $container, $builder); - } - - // StringTrimmer - if ($config['string_trimmer']['enabled'] ?? false) { - $container->import(__DIR__ . '/Resources/config/string_trimmer.php'); - } - } - - private function configureSensitiveDataSanitizer( - array $config, - ContainerConfigurator $container, - ContainerBuilder $builder, - ): void { - $builder - ->registerForAutoconfiguration(ObjectTransformerInterface::class) - ->addTag(BridgeConstantsInterface::TAG_SENSITIVE_DATA_OBJECT_TRANSFORMER); - - $builder - ->registerForAutoconfiguration(StringSanitizerInterface::class) - ->addTag(BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER); - - if ($config['sensitive_data']['use_default_object_transformers'] ?? true) { - $container->import(__DIR__ . '/Resources/config/sensitive_data_default_object_transformers.php'); - } - - if ($config['sensitive_data']['use_default_string_sanitizers'] ?? true) { - $container->import(__DIR__ . '/Resources/config/sensitive_data_default_string_sanitizers.php'); - } - - $container->import(__DIR__ . '/Resources/config/sensitive_data.php'); - - $defaultKeysToMask = ($config['sensitive_data']['use_default_keys_to_mask'] ?? true) - ? BridgeConstantsInterface::SENSITIVE_DATA_DEFAULT_KEYS_TO_MASK - : []; - - $keysToMask = $config['sensitive_data']['keys_to_mask'] ?? []; - - $container - ->parameters() - ->set( - BridgeConstantsInterface::PARAM_SENSITIVE_DATA_KEYS_TO_MASK, - \array_unique(\array_merge($defaultKeysToMask, $keysToMask)) - ); - - $container - ->parameters() - ->set( - BridgeConstantsInterface::PARAM_SENSITIVE_DATA_MASK_PATTERN, - $config['sensitive_data']['mask_pattern'] - ?? BridgeConstantsInterface::SENSITIVE_DATA_DEFAULT_MASK_PATTERN - ); - } -} diff --git a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data.php b/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data.php deleted file mode 100644 index 829f33992c..0000000000 --- a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/sensitive_data.php +++ /dev/null @@ -1,22 +0,0 @@ -services(); - $services->defaults() - ->autowire() - ->autoconfigure(); - - $services - ->set(SensitiveDataSanitizerInterface::class, SensitiveDataSanitizer::class) - ->arg('$keysToMask', param(BridgeConstantsInterface::PARAM_SENSITIVE_DATA_KEYS_TO_MASK)) - ->arg('$maskPattern', param(BridgeConstantsInterface::PARAM_SENSITIVE_DATA_MASK_PATTERN)) - ->arg('$objectTransformers', tagged_iterator(BridgeConstantsInterface::TAG_SENSITIVE_DATA_OBJECT_TRANSFORMER)) - ->arg('$stringSanitizers', tagged_iterator(BridgeConstantsInterface::TAG_SENSITIVE_DATA_STRING_SANITIZER)); -}; diff --git a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/services.php b/packages/EasyUtils/src/Bridge/Symfony/Resources/config/services.php deleted file mode 100644 index f30b280980..0000000000 --- a/packages/EasyUtils/src/Bridge/Symfony/Resources/config/services.php +++ /dev/null @@ -1,31 +0,0 @@ -services(); - $services->defaults() - ->autowire() - ->autoconfigure(); - - $services->set(CreditCardNumberValidatorInterface::class, CreditCardNumberValidator::class); - $services->set(CsvWithHeadersParserInterface::class, CsvWithHeadersParser::class); - $services->set(ForBuildEnvVarProcessor::class); - - $services->set(MathInterface::class, Math::class) - ->arg('$roundPrecision', param(BridgeConstantsInterface::PARAM_MATH_ROUND_PRECISION)) - ->arg('$roundMode', param(BridgeConstantsInterface::PARAM_MATH_ROUND_MODE)) - ->arg('$scale', param(BridgeConstantsInterface::PARAM_MATH_SCALE)) - ->arg('$decimalSeparator', param(BridgeConstantsInterface::PARAM_MATH_FORMAT_DECIMAL_SEPARATOR)) - ->arg('$thousandsSeparator', param(BridgeConstantsInterface::PARAM_MATH_FORMAT_THOUSANDS_SEPARATOR)); -}; diff --git a/packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/Abn.php b/packages/EasyUtils/src/Common/Constraint/Abn.php similarity index 93% rename from packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/Abn.php rename to packages/EasyUtils/src/Common/Constraint/Abn.php index 2b43e879c8..2b9abdfeda 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/Abn.php +++ b/packages/EasyUtils/src/Common/Constraint/Abn.php @@ -1,7 +1,7 @@ scale); } - public function compareThat(string $leftOperand): MathComparisonInterface + public function compareThat(string $leftOperand): MathComparisonHelperInterface { - return new MathComparison($leftOperand, (int)$this->scale); + return new MathComparisonHelper($leftOperand, (int)$this->scale); } public function divide(string $dividend, string $divisor, ?int $precision = null, ?int $mode = null): string diff --git a/packages/EasyUtils/src/Interfaces/MathInterface.php b/packages/EasyUtils/src/Math/Helper/MathHelperInterface.php similarity index 96% rename from packages/EasyUtils/src/Interfaces/MathInterface.php rename to packages/EasyUtils/src/Math/Helper/MathHelperInterface.php index 81affd531d..964116e2a3 100644 --- a/packages/EasyUtils/src/Interfaces/MathInterface.php +++ b/packages/EasyUtils/src/Math/Helper/MathHelperInterface.php @@ -1,9 +1,9 @@ diff --git a/packages/EasyUtils/src/Bridge/Symfony/Normalizers/IntegerNumberNormalizer.php b/packages/EasyUtils/src/Math/Normalizer/IntegerNumberNormalizer.php similarity index 89% rename from packages/EasyUtils/src/Bridge/Symfony/Normalizers/IntegerNumberNormalizer.php rename to packages/EasyUtils/src/Math/Normalizer/IntegerNumberNormalizer.php index ac38ddede5..a0706ef032 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Normalizers/IntegerNumberNormalizer.php +++ b/packages/EasyUtils/src/Math/Normalizer/IntegerNumberNormalizer.php @@ -1,9 +1,9 @@ constraint = $abstractNumberConstraint; @@ -21,7 +22,7 @@ public function validate(mixed $value, Constraint $constraint): void } /** - * @param \EonX\EasyUtils\ValueObjects\Number|int|string $value + * @param \EonX\EasyUtils\Math\ValueObject\Number|int|string $value */ protected function formatValue(mixed $value, ?int $format = null): string { diff --git a/packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/NumberGreaterOrEqualValidator.php b/packages/EasyUtils/src/Math/Validator/NumberGreaterOrEqualValidator.php similarity index 62% rename from packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/NumberGreaterOrEqualValidator.php rename to packages/EasyUtils/src/Math/Validator/NumberGreaterOrEqualValidator.php index 68704a7f4d..b697413ebc 100644 --- a/packages/EasyUtils/src/Bridge/Symfony/Validator/Constraints/NumberGreaterOrEqualValidator.php +++ b/packages/EasyUtils/src/Math/Validator/NumberGreaterOrEqualValidator.php @@ -1,13 +1,13 @@ getApplication(); - - return $app->make(MathInterface::class); - } -} diff --git a/packages/EasyUtils/tests/Bridge/Symfony/MathTest.php b/packages/EasyUtils/tests/Bridge/Symfony/MathTest.php deleted file mode 100644 index 9a418e12a7..0000000000 --- a/packages/EasyUtils/tests/Bridge/Symfony/MathTest.php +++ /dev/null @@ -1,20 +0,0 @@ -getKernel() - ->getContainer(); - - return $container->get(MathInterface::class); - } -} diff --git a/packages/EasyUtils/tests/Bridge/Symfony/SensitiveDataTest.php b/packages/EasyUtils/tests/Bridge/Symfony/SensitiveDataTest.php deleted file mode 100644 index ba1a210d67..0000000000 --- a/packages/EasyUtils/tests/Bridge/Symfony/SensitiveDataTest.php +++ /dev/null @@ -1,24 +0,0 @@ -getKernel([ - BridgeConstantsInterface::PARAM_SENSITIVE_DATA_KEYS_TO_MASK => $keysToMask ?? [], - BridgeConstantsInterface::PARAM_SENSITIVE_DATA_MASK_PATTERN => $maskPattern, - ]) - ->getContainer(); - - return $container->get(SensitiveDataSanitizerInterface::class); - } -} diff --git a/packages/EasyUtils/tests/Csv/fixtures/empty_records.csv b/packages/EasyUtils/tests/Fixture/Csv/empty_records.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/empty_records.csv rename to packages/EasyUtils/tests/Fixture/Csv/empty_records.csv diff --git a/packages/EasyUtils/tests/Csv/fixtures/empty_values.csv b/packages/EasyUtils/tests/Fixture/Csv/empty_values.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/empty_values.csv rename to packages/EasyUtils/tests/Fixture/Csv/empty_values.csv diff --git a/packages/EasyUtils/tests/Csv/fixtures/group_prefixes.csv b/packages/EasyUtils/tests/Fixture/Csv/group_prefixes.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/group_prefixes.csv rename to packages/EasyUtils/tests/Fixture/Csv/group_prefixes.csv diff --git a/packages/EasyUtils/tests/Csv/fixtures/hidden_characters.csv b/packages/EasyUtils/tests/Fixture/Csv/hidden_characters.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/hidden_characters.csv rename to packages/EasyUtils/tests/Fixture/Csv/hidden_characters.csv diff --git a/packages/EasyUtils/tests/Csv/fixtures/missing_value_for_required_header.csv b/packages/EasyUtils/tests/Fixture/Csv/missing_value_for_required_header.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/missing_value_for_required_header.csv rename to packages/EasyUtils/tests/Fixture/Csv/missing_value_for_required_header.csv diff --git a/packages/EasyUtils/tests/Csv/fixtures/simple_file.csv b/packages/EasyUtils/tests/Fixture/Csv/simple_file.csv similarity index 100% rename from packages/EasyUtils/tests/Csv/fixtures/simple_file.csv rename to packages/EasyUtils/tests/Fixture/Csv/simple_file.csv diff --git a/packages/EasyUtils/tests/SensitiveData/Fixtures/Dto/ObjectDto.php b/packages/EasyUtils/tests/Fixture/SensitiveData/DummyObject.php similarity index 68% rename from packages/EasyUtils/tests/SensitiveData/Fixtures/Dto/ObjectDto.php rename to packages/EasyUtils/tests/Fixture/SensitiveData/DummyObject.php index 274746ed29..dffb410bbc 100644 --- a/packages/EasyUtils/tests/SensitiveData/Fixtures/Dto/ObjectDto.php +++ b/packages/EasyUtils/tests/Fixture/SensitiveData/DummyObject.php @@ -1,9 +1,9 @@ - new ObjectDto( + new DummyObject( prop1: 'some-biller-code', prop2: 'some-long-name', prop3: 'some-short-name' diff --git a/packages/EasyUtils/tests/AbstractTestCase.php b/packages/EasyUtils/tests/Unit/AbstractUnitTestCase.php similarity index 85% rename from packages/EasyUtils/tests/AbstractTestCase.php rename to packages/EasyUtils/tests/Unit/AbstractUnitTestCase.php index 779df2efab..7f7254e29d 100644 --- a/packages/EasyUtils/tests/AbstractTestCase.php +++ b/packages/EasyUtils/tests/Unit/AbstractUnitTestCase.php @@ -1,7 +1,7 @@ exists($var)) { $fs->remove($var); diff --git a/packages/EasyUtils/tests/Unit/bundle/Math/Helper/MathHelperTest.php b/packages/EasyUtils/tests/Unit/bundle/Math/Helper/MathHelperTest.php new file mode 100644 index 0000000000..29e9f9db3a --- /dev/null +++ b/packages/EasyUtils/tests/Unit/bundle/Math/Helper/MathHelperTest.php @@ -0,0 +1,21 @@ +getKernel() + ->getContainer(); + + return $container->get(MathHelperInterface::class); + } +} diff --git a/packages/EasyUtils/tests/Unit/bundle/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php b/packages/EasyUtils/tests/Unit/bundle/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php new file mode 100644 index 0000000000..c62b0754cf --- /dev/null +++ b/packages/EasyUtils/tests/Unit/bundle/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php @@ -0,0 +1,25 @@ +getKernel([ + ConfigParam::SensitiveDataKeysToMask->value => $keysToMask ?? [], + ConfigParam::SensitiveDataMaskPattern->value => $maskPattern, + ]) + ->getContainer(); + + return $container->get(SensitiveDataSanitizerInterface::class); + } +} diff --git a/packages/EasyUtils/tests/Bridge/Laravel/LaravelTestCaseTrait.php b/packages/EasyUtils/tests/Unit/laravel/LaravelTestCaseTrait.php similarity index 82% rename from packages/EasyUtils/tests/Bridge/Laravel/LaravelTestCaseTrait.php rename to packages/EasyUtils/tests/Unit/laravel/LaravelTestCaseTrait.php index 5c4f2f300f..374c123246 100644 --- a/packages/EasyUtils/tests/Bridge/Laravel/LaravelTestCaseTrait.php +++ b/packages/EasyUtils/tests/Unit/laravel/LaravelTestCaseTrait.php @@ -1,9 +1,9 @@ getApplication(); + + return $app->make(MathHelperInterface::class); + } +} diff --git a/packages/EasyUtils/tests/Bridge/Laravel/Middlewares/TrimStringsTest.php b/packages/EasyUtils/tests/Unit/laravel/Middleware/TrimStringsMiddlewareTest.php similarity index 83% rename from packages/EasyUtils/tests/Bridge/Laravel/Middlewares/TrimStringsTest.php rename to packages/EasyUtils/tests/Unit/laravel/Middleware/TrimStringsMiddlewareTest.php index df58ef98d0..8311317a4b 100644 --- a/packages/EasyUtils/tests/Bridge/Laravel/Middlewares/TrimStringsTest.php +++ b/packages/EasyUtils/tests/Unit/laravel/Middleware/TrimStringsMiddlewareTest.php @@ -1,17 +1,17 @@ '123', ]; - /** @var \EonX\EasyUtils\StringTrimmers\StringTrimmerInterface $trimmer */ + /** @var \EonX\EasyUtils\Common\Trimmer\StringTrimmerInterface $trimmer */ $trimmer = $this->mock( StringTrimmerInterface::class, static function (MockInterface $mock) use ($data, $except, $expectedResult): void { @@ -36,7 +36,7 @@ static function (MockInterface $mock) use ($data, $except, $expectedResult): voi ->andReturn([]); } ); - $middleware = new TrimStrings($trimmer, $except); + $middleware = new TrimStringsMiddleware($trimmer, $except); $symfonyRequest = new SymfonyRequest($data); $symfonyRequest->server->set('REQUEST_METHOD', 'GET'); $request = Request::createFromBase($symfonyRequest); @@ -56,7 +56,7 @@ public function testHandleSucceedsWithJsonRequest(): void $expectedResult = [ 'abc' => '123', ]; - /** @var \EonX\EasyUtils\StringTrimmers\StringTrimmerInterface $trimmer */ + /** @var \EonX\EasyUtils\Common\Trimmer\StringTrimmerInterface $trimmer */ $trimmer = $this->mock( StringTrimmerInterface::class, static function (MockInterface $mock) use ($data, $except, $expectedResult): void { @@ -69,7 +69,7 @@ static function (MockInterface $mock) use ($data, $except, $expectedResult): voi ->andReturn($expectedResult); } ); - $middleware = new TrimStrings($trimmer, $except); + $middleware = new TrimStringsMiddleware($trimmer, $except); $symfonyRequest = new SymfonyRequest([], [], [], [], [], [], $json); $symfonyRequest->server->set('REQUEST_METHOD', 'POST'); $symfonyRequest->headers = new HeaderBag([ @@ -91,7 +91,7 @@ public function testHandleSucceedsWithPostRequest(): void $expectedResult = [ 'abc' => '123', ]; - /** @var \EonX\EasyUtils\StringTrimmers\StringTrimmerInterface $trimmer */ + /** @var \EonX\EasyUtils\Common\Trimmer\StringTrimmerInterface $trimmer */ $trimmer = $this->mock( StringTrimmerInterface::class, static function (MockInterface $mock) use ($data, $except, $expectedResult): void { @@ -104,7 +104,7 @@ static function (MockInterface $mock) use ($data, $except, $expectedResult): voi ->andReturn($expectedResult); } ); - $middleware = new TrimStrings($trimmer, $except); + $middleware = new TrimStringsMiddleware($trimmer, $except); $symfonyRequest = new SymfonyRequest([], $data); $symfonyRequest->server->set('REQUEST_METHOD', 'POST'); $request = Request::createFromBase($symfonyRequest); diff --git a/packages/EasyUtils/tests/Bridge/Laravel/SensitiveDataTest.php b/packages/EasyUtils/tests/Unit/laravel/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php similarity index 59% rename from packages/EasyUtils/tests/Bridge/Laravel/SensitiveDataTest.php rename to packages/EasyUtils/tests/Unit/laravel/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php index b7a69006b6..9d77075535 100644 --- a/packages/EasyUtils/tests/Bridge/Laravel/SensitiveDataTest.php +++ b/packages/EasyUtils/tests/Unit/laravel/SensitiveData/Sanitizer/SensitiveDataSanitizerTest.php @@ -1,12 +1,13 @@ mock(StringTrimmerInterface::class); $normalizer = new TrimStringsNormalizer($trimmer); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Traits/TranslatorAwareTraitTest.php b/packages/EasyUtils/tests/Unit/src/Common/Translator/TranslatorAwareTraitTest.php similarity index 70% rename from packages/EasyUtils/tests/Bridge/Symfony/Traits/TranslatorAwareTraitTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Translator/TranslatorAwareTraitTest.php index 6ef38a4700..3d5d360fbb 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Traits/TranslatorAwareTraitTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Translator/TranslatorAwareTraitTest.php @@ -1,13 +1,13 @@ [ 'data' => " \t\n\r\0\x0B" . '123' . \PHP_EOL, 'exceptKeys' => [], diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AbnValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/AbnValidatorTest.php similarity index 95% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AbnValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/AbnValidatorTest.php index 4196a21059..69bbb97ccc 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AbnValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/AbnValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Abn"' + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\Abn"' ); $validator->validate($abn, $constraint); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericHyphenValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericHyphenValidatorTest.php similarity index 92% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericHyphenValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericHyphenValidatorTest.php index 1a51463139..53870b2f04 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericHyphenValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericHyphenValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\AlphanumericHyphen"' + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\AlphanumericHyphen"' ); $validator->validate($value, $constraint); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericValidatorTest.php similarity index 92% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericValidatorTest.php index 023b5e7722..2b483c57dd 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AlphanumericValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/AlphanumericValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Alphanumeric"' + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\Alphanumeric"' ); $validator->validate($value, $constraint); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DateIntervalValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/DateIntervalValidatorTest.php similarity index 92% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DateIntervalValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/DateIntervalValidatorTest.php index c682fe3453..5fe9a996a1 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DateIntervalValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/DateIntervalValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\DateInterval"' + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\DateInterval"' ); $validator->validate($dateInterval, $constraint); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DecimalValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/DecimalValidatorTest.php similarity index 95% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DecimalValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/DecimalValidatorTest.php index 2f388437e6..2f24e6255b 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/DecimalValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/DecimalValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Decimal"' + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\Decimal"' ); $validator->validate($value, $constraint); diff --git a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/IntegerValidatorTest.php b/packages/EasyUtils/tests/Unit/src/Common/Validator/IntegerValidatorTest.php similarity index 92% rename from packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/IntegerValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/Common/Validator/IntegerValidatorTest.php index 7ab9cf053f..b47d4e55c6 100644 --- a/packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/IntegerValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/Common/Validator/IntegerValidatorTest.php @@ -1,11 +1,11 @@ expectException(UnexpectedTypeException::class); $this->expectExceptionMessage( - 'Expected argument of type "EonX\EasyUtils\Bridge\Symfony\Validator\Constraints\Integer", ' . + 'Expected argument of type "EonX\EasyUtils\Common\Constraint\Integer", ' . '"Symfony\Component\Validator\Constraint@anonymous" given' ); diff --git a/packages/EasyUtils/tests/CreditCard/CreditCardNumberValidatorTest.php b/packages/EasyUtils/tests/Unit/src/CreditCard/Validator/CreditCardNumberValidatorTest.php similarity index 91% rename from packages/EasyUtils/tests/CreditCard/CreditCardNumberValidatorTest.php rename to packages/EasyUtils/tests/Unit/src/CreditCard/Validator/CreditCardNumberValidatorTest.php index 51300bd620..95831a4f60 100644 --- a/packages/EasyUtils/tests/CreditCard/CreditCardNumberValidatorTest.php +++ b/packages/EasyUtils/tests/Unit/src/CreditCard/Validator/CreditCardNumberValidatorTest.php @@ -1,13 +1,13 @@ [ - __DIR__ . '/fixtures/simple_file.csv', + __DIR__ . '/../../../../Fixture/Csv/simple_file.csv', CsvParserConfig::create(), [ [ @@ -35,7 +35,7 @@ public static function providerTestFromFile(): iterable ]; yield 'Simple file with transformer' => [ - __DIR__ . '/fixtures/simple_file.csv', + __DIR__ . '/../../../../Fixture/Csv/simple_file.csv', CsvParserConfig::create(recordTransformers: [ static fn (array $record): array => \array_change_key_case($record, \CASE_UPPER), ]), @@ -52,7 +52,7 @@ public static function providerTestFromFile(): iterable ]; yield 'Group prefixes' => [ - __DIR__ . '/fixtures/group_prefixes.csv', + __DIR__ . '/../../../../Fixture/Csv/group_prefixes.csv', CsvParserConfig::create(null, ['accountMetadata', 'anotherPrefix']), [ [ @@ -79,7 +79,7 @@ public static function providerTestFromFile(): iterable ]; yield 'Sanitize headers' => [ - __DIR__ . '/fixtures/hidden_characters.csv', + __DIR__ . '/../../../../Fixture/Csv/hidden_characters.csv', CsvParserConfig::create(['account']), [ [ @@ -92,7 +92,7 @@ public static function providerTestFromFile(): iterable ]; yield 'Empty records not ignored' => [ - __DIR__ . '/fixtures/empty_records.csv', + __DIR__ . '/../../../../Fixture/Csv/empty_records.csv', CsvParserConfig::create(), [ [], @@ -101,7 +101,7 @@ public static function providerTestFromFile(): iterable ]; yield 'Empty records ignored' => [ - __DIR__ . '/fixtures/empty_records.csv', + __DIR__ . '/../../../../Fixture/Csv/empty_records.csv', CsvParserConfig::create(null, null, true), [], ]; @@ -113,15 +113,15 @@ public static function providerTestFromFile(): iterable public static function providerTestFromFileForException(): iterable { yield 'Value for required header missing' => [ - __DIR__ . '/fixtures/missing_value_for_required_header.csv', + __DIR__ . '/../../../../Fixture/Csv/missing_value_for_required_header.csv', CsvParserConfig::create(['required']), MissingValueForRequiredHeadersException::class, ]; } /** - * @throws \EonX\EasyUtils\Csv\Exceptions\MissingRequiredHeadersException - * @throws \EonX\EasyUtils\Csv\Exceptions\MissingValueForRequiredHeadersException + * @throws \EonX\EasyUtils\Csv\Exception\MissingRequiredHeadersException + * @throws \EonX\EasyUtils\Csv\Exception\MissingValueForRequiredHeadersException */ #[DataProvider('providerTestFromFile')] public function testFromFile(string $filename, CsvParserConfigInterface $config, array $expected): void @@ -136,8 +136,8 @@ public function testFromFile(string $filename, CsvParserConfigInterface $config, /** * @phpstan-param class-string<\Throwable> $expectedException * - * @throws \EonX\EasyUtils\Csv\Exceptions\MissingRequiredHeadersException - * @throws \EonX\EasyUtils\Csv\Exceptions\MissingValueForRequiredHeadersException + * @throws \EonX\EasyUtils\Csv\Exception\MissingRequiredHeadersException + * @throws \EonX\EasyUtils\Csv\Exception\MissingValueForRequiredHeadersException */ #[DataProvider('providerTestFromFileForException')] public function testFromFileForException( diff --git a/packages/EasyUtils/tests/Unit/src/Math/Helper/MathHelperTest.php b/packages/EasyUtils/tests/Unit/src/Math/Helper/MathHelperTest.php new file mode 100644 index 0000000000..9b2f22dc8a --- /dev/null +++ b/packages/EasyUtils/tests/Unit/src/Math/Helper/MathHelperTest.php @@ -0,0 +1,16 @@ + [ - 'packages/*/src/Bridge/Symfony/Validator/Constraints/*', + 'packages/*/src/*/Constraint/*', 'packages/*/tests/Stubs/Model/*', 'packages/*/tests/*/Fixtures/*/ApiResource/*', 'packages/*/tests/*/Fixtures/*/DataTransferObject/*', @@ -102,11 +102,11 @@ 'packages/EasyApiPlatform/tests/Application/AbstractApplicationTestCase.php', ], PhpdocAlignFixer::class => [ - 'packages/EasyUtils/src/Interfaces/MathInterface.php', - 'packages/EasyUtils/src/Math/Math.php', + 'packages/EasyUtils/src/Math/Helper/MathHelperInterface.php', + 'packages/EasyUtils/src/Math/Helper/MathHelper.php', ], PropertyTypeHintSniff::class . '.MissingNativeTypeHint' => [ - 'packages/*/src/Bridge/Symfony/Validator/Constraints/*', + 'packages/*/src/*/Constraint/*', 'packages/*/tests/Stubs/Model/*', ], PropertyTypeHintSniff::class . '.MissingTraversableTypeHintSpecification' => null, diff --git a/quality/phpstan.neon b/quality/phpstan.neon index e6ef725a92..3607e471a8 100644 --- a/quality/phpstan.neon +++ b/quality/phpstan.neon @@ -192,10 +192,10 @@ parameters: # ---- EasyTest ---- # ---- EasyUtils ---- - message: '#Comparison operation ">" between 0 and 0 is always false#' - path: %currentWorkingDirectory%/packages/EasyUtils/src/Helpers/EnvVarSubstitutionHelper.php + path: %currentWorkingDirectory%/packages/EasyUtils/src/Common/Helper/EnvVarSubstitutionHelper.php - message: '#Result of && is always false#' - path: %currentWorkingDirectory%/packages/EasyUtils/src/Helpers/EnvVarSubstitutionHelper.php + path: %currentWorkingDirectory%/packages/EasyUtils/src/Common/Helper/EnvVarSubstitutionHelper.php # ---- EasyWebhook ---- - message: '#Unsafe usage of new static\(\)#' # Until we find a better design diff --git a/quality/rector.php b/quality/rector.php index 29ad3a938e..a218855fea 100644 --- a/quality/rector.php +++ b/quality/rector.php @@ -45,7 +45,7 @@ // Skip rules AddLiteralSeparatorToNumberRector::class => [ 'packages/EasyApiToken/tests/AbstractFirebaseJwtTokenTestCase.php', - 'packages/EasyUtils/tests/Bridge/Symfony/Validator/Constraints/AbnValidatorTest.php', + 'packages/EasyUtils/tests/Unit/src/Common/Validator/AbnValidatorTest.php', ], ClassPropertyAssignToConstructorPromotionRector::class, FinalizeClassesWithoutChildrenRector::class => [