src/Container.php
protected function resolve($instance, $parameters = [])
    {
        // If the current abstract is an interface,
        // just return the concrete implementation to the callee.
        if ($this->isInterface($instance)) {
            return $this->getConcreteFromInterface($instance);
        }

        // If the current abstract type being managed as a singleton,
        // just return it to the caller instead of reinstantiating it.
        try {
            return $this->getResolvedSingleton($instance);
        } catch (\Exception $e) {
        }
        
        $concrete = $this->getConcrete($instance);

        if (!is_null($concrete)) {
            $object = $this->build($instance,
                $concrete instanceof \Closure ? $concrete($this) : $concrete);

            if ($this->isShared($instance)) {
                $this->markAsResolved($instance, $object, 'singleton');
            } else {
                $this->markAsResolved($instance, $object);
            }
        } else {
            $object = $this->build($instance, $parameters);
        }

        return $object;
    }
protected function resolve($instance, $parameters = [])
    {
        // If the current abstract is an interface,
        // just return the concrete implementation to the callee.
        if ($this->isInterface($instance)) {
            return $this->getConcreteFromInterface($instance);
        }

        // If the current abstract type being managed as a singleton,
        // just return it to the caller instead of reinstantiating it.
        try {
            return $this->getResolvedSingleton($instance);
        } catch (\Exception $e) {
        }
        
        $concrete = $this->getConcrete($instance);

        if (!is_null($concrete)) {
            $object = $this->build($instance,
                $concrete instanceof \Closure ? $concrete($this) : $concrete);

            if ($this->isShared($instance)) {
                $this->markAsResolved($instance, $object, 'singleton');
            } else {
                $this->markAsResolved($instance, $object);
            }
        } else {
            $object = $this->build($instance, $parameters);
        }

        return $object;
    }
protected function resolve ( $ instance , $ parameters = [ ] ) { // If the current abstract is an interface, // just return the concrete implementation to the callee. if ( $ this -> isInterface ( $ instance ) ) { return $ this -> getConcreteFromInterface ( $ instance ) ; } // If the current abstract type being managed as a singleton, // just return it to the caller instead of reinstantiating it. try { return $ this -> getResolvedSingleton ( $ instance ) ; } catch ( \ Exception $ e ) { } $ concrete = $ this -> getConcrete ( $ instance ) ; if ( ! is_null ( $ concrete ) ) { $ object = $ this -> build ( $ instance , $ concrete instanceof \ Closure ? $ concrete ( $ this ) : $ concrete ) ; if ( $ this -> isShared ( $ instance ) ) { $ this -> markAsResolved ( $ instance , $ object , 'singleton' ) ; } else { $ this -> markAsResolved ( $ instance , $ object ) ; } } else { $ object = $ this -> build ( $ instance , $ parameters ) ; } return $ object ; }
Resolve class dependencies in the supplied class name.

@param string $instance The class name.
@param array $parameters The needed class dependency.
@return object
Resolve class dependencies in the supplied class name .