src/Container.php
public function set(string $abstract, $concrete, bool $shared = false) : ContainerInterface
    {
        if (is_object($concrete)) {
            return $this->instance($abstract, $concrete);
        }

        if ($concrete instanceof Closure === false) {
            $concrete = function (Container $container) use ($concrete) {
                return $container->make($concrete);
            };
        }

        if ($shared === true) {
               $this->collection[$abstract] = $concrete($this);
        } else $this->collection[$abstract] = $concrete;

        return $this;
    }
public function set(string $abstract, $concrete, bool $shared = false) : ContainerInterface
    {
        if (is_object($concrete)) {
            return $this->instance($abstract, $concrete);
        }

        if ($concrete instanceof Closure === false) {
            $concrete = function (Container $container) use ($concrete) {
                return $container->make($concrete);
            };
        }

        if ($shared === true) {
               $this->collection[$abstract] = $concrete($this);
        } else $this->collection[$abstract] = $concrete;

        return $this;
    }
public function set ( string $ abstract , $ concrete , bool $ shared = false ) : ContainerInterface { if ( is_object ( $ concrete ) ) { return $ this -> instance ( $ abstract , $ concrete ) ; } if ( $ concrete instanceof Closure === false ) { $ concrete = function ( Container $ container ) use ( $ concrete ) { return $ container -> make ( $ concrete ) ; } ; } if ( $ shared === true ) { $ this -> collection [ $ abstract ] = $ concrete ( $ this ) ; } else $ this -> collection [ $ abstract ] = $ concrete ; return $ this ; }
Bind a new element to the container.

@param string                $abstract The alias name that will be used to call the element.
@param string|closure|object $concrete The element class name, or an closure that makes the element, or the object itself.
@param bool                  $shared   Define if the element will be a singleton instance.

@return ContainerInterface
Bind a new element to the container .