public function extend(string $abstract, closure $extension) : ContainerInterface
    {
        $object = $this->get($abstract);

        $this->collection[$abstract] = $extension($object, $this);

        return $this;
    }
public function extend(string $abstract, closure $extension) : ContainerInterface
    {
        $object = $this->get($abstract);

        $this->collection[$abstract] = $extension($object, $this);

        return $this;
    }
public function extend ( string $ abstract , closure $ extension ) : ContainerInterface { $ object = $ this -> get ( $ abstract ) ; $ this -> collection [ $ abstract ] = $ extension ( $ object , $ this ) ; return $ this ; }
Modify an element with a given function that receive the old element as argument.

@param string  $abstract  The alias name that will be used to call the element.
@param closure $extension The function that receives the old element and return a new or modified one.

@throws NotFoundException  When no element was found with $abstract key.
@return ContainerInterface
Modify an element with a given function that receive the old element as argument .