make resolve public to avoid boiler plate code

add resolve to public interface
This commit is contained in:
Bernhard Posselt 2015-09-13 11:35:21 +02:00
parent ca921fa1e7
commit fd74522804
2 changed files with 11 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class SimpleContainer extends Container implements IContainer {
* @return stdClass * @return stdClass
* @throws QueryException if the class could not be found or instantiated * @throws QueryException if the class could not be found or instantiated
*/ */
private function resolve($name) { public function resolve($name) {
$baseMsg = 'Could not resolve ' . $name . '!'; $baseMsg = 'Could not resolve ' . $name . '!';
try { try {
$class = new ReflectionClass($name); $class = new ReflectionClass($name);

View File

@ -43,6 +43,16 @@ use Closure;
*/ */
interface IContainer { 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. * Look up a service for a given name in the container.
* *