From 7f2b1a2bd74fd730456f91522423d0621879d2ad Mon Sep 17 00:00:00 2001 From: Sergey Makinen Date: Mon, 3 Oct 2016 23:03:16 +0300 Subject: [PATCH] Allows resolved components clearing --- Facade.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Facade.php b/Facade.php index 84d0a7c..0df76d3 100644 --- a/Facade.php +++ b/Facade.php @@ -22,7 +22,7 @@ abstract class Facade * * @var array */ - private static $_accessors; + private static $_accessors = []; /** * The facaded application. @@ -36,7 +36,27 @@ abstract class Facade * * @var object[] */ - private static $_components; + private static $_components = []; + + /** + * Clears a resolved facade component. + * + * @param string $id + */ + public static function clearResolvedFacadeComponent($id) + { + unset(self::$_accessors[$id]); + unset(self::$_components[$id]); + } + + /** + * Clears all resolved facade components. + */ + public static function clearResolvedFacadeComponents() + { + self::$_accessors = []; + self::$_components = []; + } /** * Returns a component ID being facaded. @@ -83,6 +103,7 @@ public static function getFacadeApplication() public static function setFacadeApplication(Application $value) { self::$_app = $value; + self::clearResolvedFacadeComponents(); } /**