From d001c1ff98a76bf81909acd03db4bc009bcf3eab Mon Sep 17 00:00:00 2001 From: Rougin Gutib Date: Fri, 8 Dec 2023 15:40:45 +0800 Subject: [PATCH] Fix compatibility issues from v0.8.1 --- src/Application.php | 3 +-- src/Component/Collection.php | 29 +++++++++++++++++----- src/ComponentCollection.php | 3 +-- src/Components.php | 1 - src/Configuration.php | 2 +- src/ErrorHandler/ErrorHandlerInterface.php | 3 +-- src/ErrorHandler/Whoops.php | 7 ++---- src/IoC/Auryn.php | 15 +++++++++++ src/IoC/Auryn/Container.php | 4 --- src/IoC/AurynContainer.php | 6 +---- src/IoC/ContainerInterface.php | 17 +++++++++++++ src/System.php | 8 ++++++ 12 files changed, 70 insertions(+), 28 deletions(-) create mode 100644 src/IoC/Auryn.php create mode 100644 src/IoC/ContainerInterface.php diff --git a/src/Application.php b/src/Application.php index ff913ce8..e85d2b47 100644 --- a/src/Application.php +++ b/src/Application.php @@ -5,8 +5,7 @@ /** * Application * - * Integrates all specified components into the application. - * NOTE: To be removed in v1.0.0. Use \System instead. + * NOTE: To be removed in v1.0.0. Use "System" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/Component/Collection.php b/src/Component/Collection.php index 00f72a69..4636868a 100644 --- a/src/Component/Collection.php +++ b/src/Component/Collection.php @@ -14,7 +14,6 @@ /** * Component Collection * - * Contains all the required components for Slytherin. * NOTE: To be removed in v1.0.0. Use "Integration" instead. * * @package Slytherin @@ -50,6 +49,28 @@ public function setContainer(ContainerInterface $container) return $this; } + /** + * Gets an instance of the dependency injector. + * NOTE: To be removed in v1.0.0. Use "getContainer" instead. + * + * @return \Rougin\Slytherin\IoC\ContainerInterface + */ + public function getDependencyInjector() + { + return $this->getContainer(); + } + + /** + * Sets the dependency injector. + * NOTE: To be removed in v1.0.0. Use "setContainer" instead. + * + * @param \Rougin\Slytherin\IoC\ContainerInterface $injector + */ + public function setDependencyInjector(ContainerInterface $injector) + { + return $this->setContainer($injector); + } + /** * Gets the dispatcher. * @@ -130,11 +151,7 @@ public function setErrorHandler(ErrorHandlerInterface $errorHandler) */ public function getHttp() { - $request = $this->get(System::SERVER_REQUEST); - - $response = $this->get(System::RESPONSE); - - return array($request, $response); + return array($this->getHttpRequest(), $this->getHttpResponse()); } /** diff --git a/src/ComponentCollection.php b/src/ComponentCollection.php index 4e3dafde..861d5137 100644 --- a/src/ComponentCollection.php +++ b/src/ComponentCollection.php @@ -5,8 +5,7 @@ /** * Component Collection * - * Contains all the required components for Slytherin. - * NOTE: To be removed in v1.0.0. Use "Component\Collection" instead. + * NOTE: To be removed in v1.0.0. Use "Components" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/Components.php b/src/Components.php index 28f9e2b1..55f9f19c 100644 --- a/src/Components.php +++ b/src/Components.php @@ -5,7 +5,6 @@ /** * Component Collection * - * Contains all the required components for Slytherin. * NOTE: To be removed in v1.0.0. Use "Component\Collection" instead. * * @package Slytherin diff --git a/src/Configuration.php b/src/Configuration.php index 95022a78..97abfb93 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -5,7 +5,7 @@ /** * Configuration * - * Serves as a storage for configuration data. + * NOTE: To be removed in v1.0.0. Use "Integration/Configuration" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/ErrorHandler/ErrorHandlerInterface.php b/src/ErrorHandler/ErrorHandlerInterface.php index f97b1314..d65d1277 100644 --- a/src/ErrorHandler/ErrorHandlerInterface.php +++ b/src/ErrorHandler/ErrorHandlerInterface.php @@ -7,8 +7,7 @@ /** * Error Handler Interface * - * An interface for handling third party debuggers. - * NOTE: To be removed in v1.0.0. Use "ErrorHandlerIntegration" instead. + * NOTE: To be removed in v1.0.0. Use "Debug\DebuggerInterface" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/ErrorHandler/Whoops.php b/src/ErrorHandler/Whoops.php index b6edc5d5..b415f675 100644 --- a/src/ErrorHandler/Whoops.php +++ b/src/ErrorHandler/Whoops.php @@ -2,15 +2,12 @@ namespace Rougin\Slytherin\ErrorHandler; -use Rougin\Slytherin\Debug\Whoops\Debugger; +use Rougin\Slytherin\Debug\Debugger; /** * Debugger * - * A simple implementation of a debugger built on top of Filipe Dobreira's - * Whoops. NOTE: To be removed in v1.0.0. Use "ErrorHandlerIntegration" instead. - * - * http://filp.github.io/whoops + * NOTE: To be removed in v1.0.0. Use "Debug\Debugger" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/IoC/Auryn.php b/src/IoC/Auryn.php new file mode 100644 index 00000000..dde3021c --- /dev/null +++ b/src/IoC/Auryn.php @@ -0,0 +1,15 @@ + + */ +class Auryn extends AurynContainer +{ +} diff --git a/src/IoC/Auryn/Container.php b/src/IoC/Auryn/Container.php index 586344fb..da092167 100644 --- a/src/IoC/Auryn/Container.php +++ b/src/IoC/Auryn/Container.php @@ -7,12 +7,8 @@ /** * Auryn Container * - * A simple implementation of a container that is built on top of - * Daniel Lowrey's Auryn Inversion Of Control (IoC) Dependency Injector. * NOTE: To be removed in v1.0.0. Use "Container\AurynContainer" instead. * - * https://github.com/rdlowrey/auryn - * * @package Slytherin * @author Rougin Gutib */ diff --git a/src/IoC/AurynContainer.php b/src/IoC/AurynContainer.php index efb21f9b..5e92a9a7 100644 --- a/src/IoC/AurynContainer.php +++ b/src/IoC/AurynContainer.php @@ -5,11 +5,7 @@ /** * Auryn Container * - * A simple implementation of a container that is built on top of - * Daniel Lowrey's Auryn Inversion Of Control (IoC) Dependency Injector. - * NOTE: To be removed in v1.0.0. Use "Container\AurynContainer" instead. - * - * https://github.com/rdlowrey/auryn + * NOTE: To be removed in v1.0.0. Use "Auryn\Container" instead. * * @package Slytherin * @author Rougin Gutib diff --git a/src/IoC/ContainerInterface.php b/src/IoC/ContainerInterface.php new file mode 100644 index 00000000..dc325dba --- /dev/null +++ b/src/IoC/ContainerInterface.php @@ -0,0 +1,17 @@ + + */ +interface ContainerInterface extends Slytherin +{ +} diff --git a/src/System.php b/src/System.php index 19da2a5a..bdfe4c5a 100644 --- a/src/System.php +++ b/src/System.php @@ -8,6 +8,14 @@ use Rougin\Slytherin\Integration\ConfigurationInterface; use Rougin\Slytherin\System\Handler; +/** + * System Application + * + * Integrates all specified components into the application. + * + * @package Slytherin + * @author Rougin Gutib + */ class System { const CONTAINER = 'Psr\Container\ContainerInterface';