src/Box/Box.php
public function wrap($name)
    {
        if (!isset($this->_definitions[$name])) {
            throw new BoxException("Unexisting `{$name}` definition dependency.");
        }
        if (!$this->_definitions[$name]['definition'] instanceof Closure) {
            throw new BoxException("Error `{$name}` is not a closure definition dependency can't be wrapped.");
        }

        $params = func_get_args();
        array_shift($params);

        $wrapper = $this->_classes['wrapper'];
        return new $wrapper([
            'box'    => $this,
            'name'   => $name,
            'params' => $params
        ]);
    }
public function wrap($name)
    {
        if (!isset($this->_definitions[$name])) {
            throw new BoxException("Unexisting `{$name}` definition dependency.");
        }
        if (!$this->_definitions[$name]['definition'] instanceof Closure) {
            throw new BoxException("Error `{$name}` is not a closure definition dependency can't be wrapped.");
        }

        $params = func_get_args();
        array_shift($params);

        $wrapper = $this->_classes['wrapper'];
        return new $wrapper([
            'box'    => $this,
            'name'   => $name,
            'params' => $params
        ]);
    }
public function wrap ( $ name ) { if ( ! isset ( $ this -> _definitions [ $ name ] ) ) { throw new BoxException ( "Unexisting `{$name}` definition dependency." ) ; } if ( ! $ this -> _definitions [ $ name ] [ 'definition' ] instanceof Closure ) { throw new BoxException ( "Error `{$name}` is not a closure definition dependency can't be wrapped." ) ; } $ params = func_get_args ( ) ; array_shift ( $ params ) ; $ wrapper = $ this -> _classes [ 'wrapper' ] ; return new $ wrapper ( [ 'box' => $ this , 'name' => $ name , 'params' => $ params ] ) ; }
Returns a dependency container.

@param  string $name The name of the definition.
@param  mixed  ...   A list of parameters.
@return mixed        The shared variable or an new instance.
@throws BoxException if the definition doesn't exists.
Returns a dependency container .