src/Container.php
public function instance(string $abstract, $instance) : ContainerInterface
    {
        if (! is_object($instance)) {
            throw new ContainerException('Trying to store ' . gettype($instance) . ' as object.');
        }

        $this->collection[$abstract] = $instance;

        return $this;
    }
public function instance(string $abstract, $instance) : ContainerInterface
    {
        if (! is_object($instance)) {
            throw new ContainerException('Trying to store ' . gettype($instance) . ' as object.');
        }

        $this->collection[$abstract] = $instance;

        return $this;
    }
public function instance ( string $ abstract , $ instance ) : ContainerInterface { if ( ! is_object ( $ instance ) ) { throw new ContainerException ( 'Trying to store ' . gettype ( $ instance ) . ' as object.' ) ; } $ this -> collection [ $ abstract ] = $ instance ; return $ this ; }
Bind an object to the container.

@param string $abstract The alias name that will be used to call the object.
@param object $instance The object that will be inserted.

@throws ContainerException When $instance is not an object.
@return ContainerInterface
Bind an object to the container .