From be9e1bca1db596412a1d4e2300db9b52d08154dc Mon Sep 17 00:00:00 2001 From: Shiroe_sama <shiroes45@gmail.com> Date: Sat, 21 Dec 2024 18:33:31 +0100 Subject: [PATCH] Review : Project structures. --- .../Exception/SQLConnexionBuilderException.php | 2 +- .../Builder/MySQLConnexionBuilder.php | 4 ++-- .../Builder/PostgreSQLConnexionBuilder.php | 4 ++-- src/{ => Connexion}/Builder/SQLConnexionBuilder.php | 4 ++-- .../Resolver/SQLManagerResolverException.php} | 8 ++++---- src/{ => Manager}/Resolver/SQLManagerResolver.php | 12 ++++++------ src/Manager/SQLManager.php | 8 ++++---- src/Manager/SQLManagerInterface.php | 4 ++-- src/{ => Query}/Resolver/SQLQueryResolver.php | 2 +- src/Query/SQLQuery.php | 2 +- src/Repository/AbstractSQLRepository.php | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) rename src/{ => Connexion}/Builder/Exception/SQLConnexionBuilderException.php (93%) rename src/{ => Connexion}/Builder/MySQLConnexionBuilder.php (97%) rename src/{ => Connexion}/Builder/PostgreSQLConnexionBuilder.php (97%) rename src/{ => Connexion}/Builder/SQLConnexionBuilder.php (96%) rename src/{Resolver/Exception/SQLResolverException.php => Manager/Exception/Resolver/SQLManagerResolverException.php} (73%) rename src/{ => Manager}/Resolver/SQLManagerResolver.php (91%) rename src/{ => Query}/Resolver/SQLQueryResolver.php (98%) diff --git a/src/Builder/Exception/SQLConnexionBuilderException.php b/src/Connexion/Builder/Exception/SQLConnexionBuilderException.php similarity index 93% rename from src/Builder/Exception/SQLConnexionBuilderException.php rename to src/Connexion/Builder/Exception/SQLConnexionBuilderException.php index 67e0668..4ad35a3 100644 --- a/src/Builder/Exception/SQLConnexionBuilderException.php +++ b/src/Connexion/Builder/Exception/SQLConnexionBuilderException.php @@ -13,7 +13,7 @@ * -------------------------------------------------------------------------- */ -namespace Luna\SQL\Builder\Exception; +namespace Luna\SQL\Connexion\Builder\Exception; use Luna\Exception\LunaException; diff --git a/src/Builder/MySQLConnexionBuilder.php b/src/Connexion/Builder/MySQLConnexionBuilder.php similarity index 97% rename from src/Builder/MySQLConnexionBuilder.php rename to src/Connexion/Builder/MySQLConnexionBuilder.php index 9361e0f..43da460 100644 --- a/src/Builder/MySQLConnexionBuilder.php +++ b/src/Connexion/Builder/MySQLConnexionBuilder.php @@ -13,12 +13,12 @@ * ---------------------------------------------------------------- */ -namespace Luna\SQL\Builder; +namespace Luna\SQL\Connexion\Builder; use Luna\Component\Bag\BagInterface; use Luna\Component\Manager\TypeManager; use Luna\Component\Manager\ValueManager; -use Luna\SQL\Builder\Exception\SQLConnexionBuilderException; +use Luna\SQL\Connexion\Builder\Exception\SQLConnexionBuilderException; use Luna\SQL\Connexion\MySQLConnexion; use PDOException; diff --git a/src/Builder/PostgreSQLConnexionBuilder.php b/src/Connexion/Builder/PostgreSQLConnexionBuilder.php similarity index 97% rename from src/Builder/PostgreSQLConnexionBuilder.php rename to src/Connexion/Builder/PostgreSQLConnexionBuilder.php index dc43827..e29584d 100644 --- a/src/Builder/PostgreSQLConnexionBuilder.php +++ b/src/Connexion/Builder/PostgreSQLConnexionBuilder.php @@ -13,12 +13,12 @@ * ---------------------------------------------------------------- */ -namespace Luna\SQL\Builder; +namespace Luna\SQL\Connexion\Builder; use Luna\Component\Bag\BagInterface; use Luna\Component\Manager\TypeManager; use Luna\Component\Manager\ValueManager; -use Luna\SQL\Builder\Exception\SQLConnexionBuilderException; +use Luna\SQL\Connexion\Builder\Exception\SQLConnexionBuilderException; use Luna\SQL\Connexion\PostgreSQLConnexion; class PostgreSQLConnexionBuilder diff --git a/src/Builder/SQLConnexionBuilder.php b/src/Connexion/Builder/SQLConnexionBuilder.php similarity index 96% rename from src/Builder/SQLConnexionBuilder.php rename to src/Connexion/Builder/SQLConnexionBuilder.php index 9c15b2e..5c16f1b 100644 --- a/src/Builder/SQLConnexionBuilder.php +++ b/src/Connexion/Builder/SQLConnexionBuilder.php @@ -13,11 +13,11 @@ * ---------------------------------------------------------------- */ -namespace Luna\SQL\Builder; +namespace Luna\SQL\Connexion\Builder; use Luna\Component\Bag\BagInterface; use Luna\Component\Manager\ValueManager; -use Luna\SQL\Builder\Exception\SQLConnexionBuilderException; +use Luna\SQL\Connexion\Builder\Exception\SQLConnexionBuilderException; use Luna\SQL\Connexion\SQLConnexionInterface; use Luna\SQL\Constant\SQLConstant; use PDOException; diff --git a/src/Resolver/Exception/SQLResolverException.php b/src/Manager/Exception/Resolver/SQLManagerResolverException.php similarity index 73% rename from src/Resolver/Exception/SQLResolverException.php rename to src/Manager/Exception/Resolver/SQLManagerResolverException.php index ef22400..6cbb808 100644 --- a/src/Resolver/Exception/SQLResolverException.php +++ b/src/Manager/Exception/Resolver/SQLManagerResolverException.php @@ -7,20 +7,20 @@ * * @Author : Alexandre Caillot * - * @File : SQLResolverException.php + * @File : SQLManagerResolverException.php * @Created_at : 17/12/2020 * @Update_at : 20/12/2024 * -------------------------------------------------------------------------- */ -namespace Luna\SQL\Resolver\Exception; +namespace Luna\SQL\Manager\Exception\Resolver; use Luna\Exception\LunaException; -class SQLResolverException extends LunaException +class SQLManagerResolverException extends LunaException { # -------------------------------- # Constants - public const DEFAULT_MESSAGE = 'An error is occurred during sql resolve process.'; + public const DEFAULT_MESSAGE = 'An error is occurred during sql manager resolve process.'; } diff --git a/src/Resolver/SQLManagerResolver.php b/src/Manager/Resolver/SQLManagerResolver.php similarity index 91% rename from src/Resolver/SQLManagerResolver.php rename to src/Manager/Resolver/SQLManagerResolver.php index eebd36b..aa13d57 100644 --- a/src/Resolver/SQLManagerResolver.php +++ b/src/Manager/Resolver/SQLManagerResolver.php @@ -13,19 +13,19 @@ * ---------------------------------------------------------------- */ -namespace Luna\SQL\Resolver; +namespace Luna\SQL\Manager\Resolver; use Luna\Component\Container\Exception\ContainerException; use Luna\Component\Container\LunaContainer; use Luna\Component\Manager\ClassManager; use Luna\Component\Manager\ValueManager; use Luna\Config\LunaConfig; -use Luna\SQL\Builder\Exception\SQLConnexionBuilderException; -use Luna\SQL\Builder\SQLConnexionBuilder; +use Luna\SQL\Connexion\Builder\Exception\SQLConnexionBuilderException; +use Luna\SQL\Connexion\Builder\SQLConnexionBuilder; use Luna\SQL\Connexion\SQLConnexionInterface; use Luna\SQL\Constant\SQLConstant; +use Luna\SQL\Manager\Exception\Resolver\SQLManagerResolverException; use Luna\SQL\Manager\SQLManagerInterface; -use Luna\SQL\Resolver\Exception\SQLResolverException; class SQLManagerResolver { @@ -75,7 +75,7 @@ class SQLManagerResolver * * @return SQLConnexionInterface * @throws SQLConnexionBuilderException - * @throws SQLResolverException + * @throws SQLManagerResolverException */ public function resolveConnexion( SQLConnexionInterface|string $connexion @@ -114,7 +114,7 @@ class SQLManagerResolver } // Default : No connexion is available - throw new SQLResolverException( + throw new SQLManagerResolverException( message : "Can't resolve the sql connexion. Please verify the key and the SQL storage config.", parameters: ['key' => $key, 'connexion' => $connexion], ); diff --git a/src/Manager/SQLManager.php b/src/Manager/SQLManager.php index bba8aa0..99340e2 100644 --- a/src/Manager/SQLManager.php +++ b/src/Manager/SQLManager.php @@ -23,14 +23,14 @@ use Luna\Component\DI\Exception\DependencyInjectorException; use Luna\Component\Manager\ClassManager; use Luna\Component\Manager\TypeManager; use Luna\Component\Manager\ValueManager; -use Luna\SQL\Builder\Exception\SQLConnexionBuilderException; +use Luna\SQL\Connexion\Builder\Exception\SQLConnexionBuilderException; use Luna\SQL\Connexion\SQLConnexionInterface; +use Luna\SQL\Manager\Exception\Resolver\SQLManagerResolverException; use Luna\SQL\Manager\Exception\SQLManagerException; +use Luna\SQL\Manager\Resolver\SQLManagerResolver; use Luna\SQL\Query\Exception\SQLQueryException; use Luna\SQL\Query\SQLQuery; use Luna\SQL\Query\SQLQueryInterface; -use Luna\SQL\Resolver\Exception\SQLResolverException; -use Luna\SQL\Resolver\SQLManagerResolver; use ReflectionException; class SQLManager implements SQLManagerInterface @@ -83,7 +83,7 @@ class SQLManager implements SQLManagerInterface * @throws ReflectionException * @throws SQLConnexionBuilderException * @throws SQLQueryException - * @throws SQLResolverException + * @throws SQLManagerResolverException */ public function execute( SQLConnexionInterface|string $connexion, diff --git a/src/Manager/SQLManagerInterface.php b/src/Manager/SQLManagerInterface.php index cbe3b66..436cba0 100644 --- a/src/Manager/SQLManagerInterface.php +++ b/src/Manager/SQLManagerInterface.php @@ -18,7 +18,7 @@ namespace Luna\SQL\Manager; use Luna\Component\Bag\BagInterface; use Luna\Component\Bag\ReadOnlyBag; use Luna\SQL\Connexion\SQLConnexionInterface; -use Luna\SQL\Resolver\Exception\SQLResolverException; +use Luna\SQL\Manager\Exception\Resolver\SQLManagerResolverException; interface SQLManagerInterface { @@ -42,7 +42,7 @@ interface SQLManagerInterface * @param int|null $status * * @return mixed - * @throws SQLResolverException + * @throws SQLManagerResolverException */ public function execute( SQLConnexionInterface|string $connexion, diff --git a/src/Resolver/SQLQueryResolver.php b/src/Query/Resolver/SQLQueryResolver.php similarity index 98% rename from src/Resolver/SQLQueryResolver.php rename to src/Query/Resolver/SQLQueryResolver.php index 90d3b70..c29db0f 100644 --- a/src/Resolver/SQLQueryResolver.php +++ b/src/Query/Resolver/SQLQueryResolver.php @@ -13,7 +13,7 @@ * ---------------------------------------------------------------- */ -namespace Luna\SQL\Resolver; +namespace Luna\SQL\Query\Resolver; use Luna\Component\Bag\BagInterface; use Luna\Component\Manager\TypeManager; diff --git a/src/Query/SQLQuery.php b/src/Query/SQLQuery.php index ff2711e..b4c1137 100644 --- a/src/Query/SQLQuery.php +++ b/src/Query/SQLQuery.php @@ -24,7 +24,7 @@ use Luna\Component\Manager\TypeManager; use Luna\Component\Manager\ValueManager; use Luna\SQL\Connexion\SQLConnexionInterface; use Luna\SQL\Query\Exception\SQLQueryException; -use Luna\SQL\Resolver\SQLQueryResolver; +use Luna\SQL\Query\Resolver\SQLQueryResolver; use Luna\SQL\Transaction\SQLTransaction; use Luna\SQL\Transaction\SQLTransactionInterface; use PDOException; diff --git a/src/Repository/AbstractSQLRepository.php b/src/Repository/AbstractSQLRepository.php index 943e058..a7cd6f6 100644 --- a/src/Repository/AbstractSQLRepository.php +++ b/src/Repository/AbstractSQLRepository.php @@ -17,8 +17,8 @@ namespace Luna\SQL\Repository; use Luna\Component\Bag\BagInterface; use Luna\SQL\Connexion\SQLConnexionInterface; +use Luna\SQL\Manager\Exception\Resolver\SQLManagerResolverException; use Luna\SQL\Manager\SQLManagerInterface; -use Luna\SQL\Resolver\Exception\SQLResolverException; abstract class AbstractSQLRepository implements SQLRepositoryInterface { @@ -51,7 +51,7 @@ abstract class AbstractSQLRepository implements SQLRepositoryInterface /** * @inheritDoc * - * @throws SQLResolverException + * @throws SQLManagerResolverException */ public function execute( SQLConnexionInterface|string $connexion, -- GitLab