public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR)
    {
        if (!is_a($instance, $class))
            throw new DIException("Instance should be a subclass of $class");

        if (!isset($this->objects[$class]))
            $this->objects[$class] = [];

        $this->objects[$class][$selector] = $instance;
    }
public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR)
    {
        if (!is_a($instance, $class))
            throw new DIException("Instance should be a subclass of $class");

        if (!isset($this->objects[$class]))
            $this->objects[$class] = [];

        $this->objects[$class][$selector] = $instance;
    }
public function setInstance ( string $ class , $ instance , string $ selector = Injector :: DEFAULT_SELECTOR ) { if ( ! is_a ( $ instance , $ class ) ) throw new DIException ( "Instance should be a subclass of $class" ) ; if ( ! isset ( $ this -> objects [ $ class ] ) ) $ this -> objects [ $ class ] = [ ] ; $ this -> objects [ $ class ] [ $ selector ] = $ instance ; }
Set a specific instance of class

@param string $class The name of the class
@param string $selector Where multiple instances may exist, they can be caterogized by a selector
@param object $instance The instance to set for this class
Set a specific instance of class