src/Di/Container.php
public function set(object $object, string $alias = null)
    {
        $class = get_class($object);
        $this->instances[$class] = $object;

        if (isset($alias)) {
            $this->addAlias($alias, $class);
        }

        $interfaces = class_implements($object);
        if (is_array($interfaces)) {
            foreach ($interfaces as $i) {
                $this->addInterface($i, $class);
            }
        }

        return $this;
    }
public function set(object $object, string $alias = null)
    {
        $class = get_class($object);
        $this->instances[$class] = $object;

        if (isset($alias)) {
            $this->addAlias($alias, $class);
        }

        $interfaces = class_implements($object);
        if (is_array($interfaces)) {
            foreach ($interfaces as $i) {
                $this->addInterface($i, $class);
            }
        }

        return $this;
    }
public function set ( object $ object , string $ alias = null ) { $ class = get_class ( $ object ) ; $ this -> instances [ $ class ] = $ object ; if ( isset ( $ alias ) ) { $ this -> addAlias ( $ alias , $ class ) ; } $ interfaces = class_implements ( $ object ) ; if ( is_array ( $ interfaces ) ) { foreach ( $ interfaces as $ i ) { $ this -> addInterface ( $ i , $ class ) ; } } return $ this ; }
Set an object instance. Chainable

@param  object $object
@param  string|null $alias
@return Container
Set an object instance . Chainable