From fd745228043d04b5082995d552803e486094643c Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sun, 13 Sep 2015 11:35:21 +0200 Subject: [PATCH] make resolve public to avoid boiler plate code add resolve to public interface --- lib/private/appframework/utility/simplecontainer.php | 2 +- lib/public/icontainer.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/private/appframework/utility/simplecontainer.php b/lib/private/appframework/utility/simplecontainer.php index 83a08acde2..5d7ea48752 100644 --- a/lib/private/appframework/utility/simplecontainer.php +++ b/lib/private/appframework/utility/simplecontainer.php @@ -77,7 +77,7 @@ class SimpleContainer extends Container implements IContainer { * @return stdClass * @throws QueryException if the class could not be found or instantiated */ - private function resolve($name) { + public function resolve($name) { $baseMsg = 'Could not resolve ' . $name . '!'; try { $class = new ReflectionClass($name); diff --git a/lib/public/icontainer.php b/lib/public/icontainer.php index 75ff5e97b6..ffd1d16c97 100644 --- a/lib/public/icontainer.php +++ b/lib/public/icontainer.php @@ -43,6 +43,16 @@ use Closure; */ interface IContainer { + /** + * If a parameter is not registered in the container try to instantiate it + * by using reflection to find out how to build the class + * @param string $name the class name to resolve + * @return \stdClass + * @since 8.2.0 + * @throws QueryException if the class could not be found or instantiated + */ + public function resolve($name); + /** * Look up a service for a given name in the container. *