Resolve a class based dependency from the container.

@param mixed $concrete

@return mixed
@throws BindingResolutionException
320626
protected function resolve( $concrete )
	{
		if( $concrete instanceof Closure ) {
			return $concrete( $this );
		}

		$reflector = new ReflectionClass( $concrete );

		if( !$reflector->isInstantiable() ) {
			return $this->notInstantiable( $concrete );
		}

		if( is_null(( $constructor = $reflector->getConstructor() ))) {
			return new $concrete;
		}

		return $reflector->newInstanceArgs(
			$this->resolveDependencies( $constructor->getParameters() )
		);
	}
1265443
public function resolve($concrete, $params)
    {
        if ($concrete instanceof \Closure) {
            return $concrete($this, $params);
        }
        $reflector = new \ReflectionClass($concrete);
        // check if class is instantiable
        if (!$reflector->isInstantiable()) {
            throw new \Exception("Class {$concrete} is not instantiable", 500);
        }
        // get class constructor
        $constructor = $reflector->getConstructor();
        if (is_null($constructor)) {
            // get new instance from class
            return $reflector->newInstance();
        }
        // get constructor params
        $parameters = $constructor->getParameters();
        $dependencies = $this->getResolveDependencies($parameters, $params);
        // get new instance with dependencies resolved
        return $reflector->newInstanceArgs($dependencies);
    }
1283286
public function resolve()
    {
        $instance = null;

        $args = [];

        if (isset($this->concrete)) {

            $reflected_class = new \ReflectionClass($this->concrete);

        } else {

            throw new ResolveException;
        }

        $reflected_method = $reflected_class->getConstructor();

        if ($reflected_method) {
            $args = $this->resolveArgs($reflected_method, $this->args);
        }

        $instance = $reflected_class->newInstanceArgs($args);

        foreach ($this->afters as $after) {

            $after($instance);
        }

        return $instance;
    }
715039
protected function resolveDependency(ReflectionParameter $dep) {
        $depName = $dep->getName();

        if ($dep->getClass()) {
            $depName = $dep->getClass()->name;
        }

        // bound
        if (array_key_exists($depName, $this->bindings)) {
            return $this->resolve($depName);
        }

        // unbound
        if (class_exists('\\' . $depName)) {
            return $this->make($depName);
        }

        // check for default val
        if ($dep->isDefaultValueAvailable()) {
            return $dep->getDefaultValue();
        }

        throw new ResolutionException(
            "Unable to resolve dependency {$depName} for {$dep->getDeclaringClass()->name}"
        );
    }
1313322
protected function resolveBinding($key, $value)
    {
        // Explicit binding
        if (isset($this->bindings[$key])) {
            list($binder, $errorHandler) = $this->bindings[$key];

            $callable = $this->getBindingCallable($binder, $value);

            return $this->callBindingCallable($callable, $value, $errorHandler);
        }

        // Implicit binding
        foreach ($this->implicitBindings as $binding) {
            $class = $binding['namespace'] . '\\' . $binding['prefix'] . ucfirst($key) . $binding['suffix'];

            if (class_exists($class)) {
                $instance = $this->resolveClass($class);

                // If special method name is defined, use it, otherwise, use the default
                if ($method = $binding['method']) {
                    $callable = [$instance, $method];
                } else {
                    $callable = $this->getDefaultBindingResolver($instance, $value);
                }

                return $this->callBindingCallable(
                    $callable,
                    $value,
                    $binding['errorHandler']
                );
            }
        }

        // Return the value unchanged if no binding found
        return $value;
    }
787163
public final function get($className, CacheInterface $cache = null)
   {
       try {
           return $this->resolve($className, $cache);
       } catch (NotFoundException $e) {
           throw $e;
       } catch (ContainerException $e) {
           throw $e;
       }
   }
339873
public function resolve($binding)
    {
        $rawObject = $this->getRaw($binding);

        // If the abstract is not registered, do it now for easy resolution.
        if (is_null($rawObject)) {
            // Pass $binding to both so it doesn't need to check if null again.
            $this->bind($binding, $binding);

			$rawObject = $this->getRaw($binding);
        }

        return $rawObject($this);
    }
553356
public function resolve($reference)
    {
        $reference = substr($reference, 7);
        $method = $this->getMethod($reference);
        $callback = [
            $this->container->resolve($method->getOwner()),
            $method->getName()
        ];

        if ($method->hasArguments()) {
            return function () use($callback, $method)
            {
                return call_user_func_array($callback, $method->extractArguments($this->container, new ArrayResolver()));
            };
        }

        return is_array($callback) ? function () use ($callback) {
            return call_user_func_array($callback, func_get_args());
        } : $callback;
    }
305432
public function resolve(ContainerInterface $container, $id, $definition)
    {
        if (is_null($definition)) {
            $definition = $id;
        }

        $reflection = new ReflectionClass($definition);
        if (!$reflection->isInstantiable()) {
            return false;
        }

        $constructor = $reflection->getConstructor();
        if (is_null($constructor)) {
            return $reflection->newInstance();
        }

        $dependencies = [];
        foreach ($constructor->getParameters() as $parameter) {
            $class = $parameter->getClass();
            if (is_null($class)) {
                return false;
            }
            $dependencies[] = $container->get($class->getName());
        };

        return $reflection->newInstanceArgs($dependencies);
    }
1135317
protected function getConcrete($abstract)
	{
		if ( ! is_null($concrete = $this->getContextualConcrete($abstract)))
		{
			return $concrete;
		}

		// If we don't have a registered resolver or concrete for the type, we'll just
		// assume each type is a concrete name and will attempt to resolve it as is
		// since the container should be able to resolve concretes automatically.
		if ( ! isset($this->bindings[$abstract]))
		{
			if ($this->missingLeadingSlash($abstract) &&
				isset($this->bindings['\\'.$abstract]))
			{
				$abstract = '\\'.$abstract;
			}

			return $abstract;
		}

		return $this->bindings[$abstract]['concrete'];
	}
568918
public function when($concrete)
    {
        $aliases = [];

        foreach (Arr::wrap($concrete) as $c) {
            $aliases[] = $this->getAlias($c);
        }

        return new ContextualBindingBuilder($this, $aliases);
    }
376048
public function bind($abstract, $concrete = null, $shared = false)
    {
        $this->dropStaleInstances($abstract);

        // If no concrete type was given, we will simply set the concrete type to the
        // abstract type. After that, the concrete type to be registered as shared
        // without being forced to state their classes in both of the parameters.
        if (is_null($concrete)) {
            $concrete = $abstract;
        }

        // If the factory is not a Closure, it means it is just a class name which is
        // bound into this container to the abstract type and we will just wrap it
        // up inside its own Closure to give us more convenience when extending.
        if (! $concrete instanceof Closure) {
            $concrete = $this->getClosure($abstract, $concrete);
        }

        $this->bindings[$abstract] = compact('concrete', 'shared');

        // If the abstract type was already resolved in this container we'll fire the
        // rebound listener so that any objects which have already gotten resolved
        // can have their copy of the object updated via the listener callbacks.
        if ($this->resolved($abstract)) {
            $this->rebound($abstract);
        }
    }
147167
public function get($class) {
		if (isset($this->aliases[$class])) {
			$class = $this->aliases[$class];
		}

		if (isset($this->resolvingClasses[$class])) {
			throw new CyclicDependencyException("Cyclic dependency detected when resolving $class");
		}

		$this->resolvingClasses[$class] = true;

		if (array_key_exists($class, $this->factories)) {
			$instance = $this->getFactory($class);
		} else {
			$instance = $this->getSingleton($class);
		}

		unset($this->resolvingClasses[$class]);

		return $instance;
	}
232998
public function resolve( $abstract, array $parameters = [] ) {

		// Get the true abstract name.
		$abstract = $this->getAbstract( $abstract );

		// If this is being managed as an instance and we already have
		// the instance, return it now.
		if ( isset( $this->instances[ $abstract ] ) ) {

			return $this->instances[ $abstract ];
		}

		// Get the concrete implementation.
		$concrete = $this->getConcrete( $abstract );

		// If we can't build an object, assume we should return the value.
		if ( ! $this->isBuildable( $concrete ) ) {

			// If we don't actually have this, return false.
			if ( ! $this->has( $abstract ) ) {
				return false;
			}

			return $concrete;
		}

		// Build the object.
		$object = $this->build( $concrete, $parameters );

		if ( ! $this->has( $abstract ) ) {
			return $object;
		}

		// If shared instance, make sure to store it in the instances
		// array so that we're not creating new objects later.
		if ( $this->bindings[ $abstract ]['shared'] && ! isset( $this->instances[ $abstract ] ) ) {

			$this->instances[ $abstract ] = $object;
		}

		// Run through each of the extensions for the object.
		foreach ( $this->extensions[ $abstract ] as $extension ) {

			$object = new $extension( $object, $this );
		}

		// Return the object.
		return $object;
	}
1067948
private function resolve($definition)
    {
        return !is_null($this->resolver) ? $this->resolver->resolve($definition) : $definition;
    }
330325
public function resolve($key)
    {
        try {
            return $this->resolver->resolve($key);
        } catch (\Exception $e) {
            throw new UnresolvableObjectException($key, $e);
        }
    }
878510
public function bind($abstract, $concrete = null, $shared = false)
		{
			// If the given types are actually an array, we will assume an alias is being
			// defined and will grab this "real" abstract class name and register this
			// alias with the container so that it can be used as a shortcut for it.
			if (Arrays::is($abstract)) {
				list($abstract, $alias) = $this->extractAlias($abstract);

				$this->alias($abstract, $alias);
			}

			// If no concrete type was given, we will simply set the concrete type to the
			// abstract type. This will allow concrete type to be registered as shared
			// without being forced to state their classes in both of the parameter.
			$this->dropStaleInstances($abstract);

			if (is_null($concrete)) {
				$concrete = $abstract;
			}

			// If the factory is not a Closure, it means it is just a class name which is
			// is bound into this container to the abstract type and we will just wrap
			// it up inside a Closure to make things more convenient when extending.
			if ( ! $concrete instanceof Closure) {
				$concrete = $this->getClosure($abstract, $concrete);
			}

			$bound = $this->bound($abstract);

			$this->bindings[$abstract] = compact('concrete', 'shared');

			// If the abstract type was already bound in this container, we will fire the
			// rebound listener so that any objects which have already gotten resolved
			// can have their copy of the object updated via the listener callbacks.
			if ($bound) {
				$this->rebound($abstract);
			}
		}