function nest(Container $container, $namespace = null)
    {
        // Use Container Namespace if not provided as argument
        ($namespace !== null) ?: $namespace = $container->getName();

        if ($namespace === null || $namespace === '')
            throw new \InvalidArgumentException(
                'Namespace can`t be empty.'
            );

        $cNamespace = $this->_normalizeNamespace($namespace);
        if (isset($this->__nestRight[$cNamespace]))
            throw new \InvalidArgumentException(sprintf(
                'Namespace (%s) is exists on container:%s'
                , $namespace , $this->getPath()
            ));

        $nestedCnt = $container;
        $nestedCnt->__nestLeft = $this; // set parent container
        $nestedCnt->setName($namespace);
        $this->__nestRight[$cNamespace] = $nestedCnt;
        return $this;
    }
function nest(Container $container, $namespace = null)
    {
        // Use Container Namespace if not provided as argument
        ($namespace !== null) ?: $namespace = $container->getName();

        if ($namespace === null || $namespace === '')
            throw new \InvalidArgumentException(
                'Namespace can`t be empty.'
            );

        $cNamespace = $this->_normalizeNamespace($namespace);
        if (isset($this->__nestRight[$cNamespace]))
            throw new \InvalidArgumentException(sprintf(
                'Namespace (%s) is exists on container:%s'
                , $namespace , $this->getPath()
            ));

        $nestedCnt = $container;
        $nestedCnt->__nestLeft = $this; // set parent container
        $nestedCnt->setName($namespace);
        $this->__nestRight[$cNamespace] = $nestedCnt;
        return $this;
    }
function nest ( Container $ container , $ namespace = null ) { // Use Container Namespace if not provided as argument ( $ namespace !== null ) ? : $ namespace = $ container -> getName ( ) ; if ( $ namespace === null || $ namespace === '' ) throw new \ InvalidArgumentException ( 'Namespace can`t be empty.' ) ; $ cNamespace = $ this -> _normalizeNamespace ( $ namespace ) ; if ( isset ( $ this -> __nestRight [ $ cNamespace ] ) ) throw new \ InvalidArgumentException ( sprintf ( 'Namespace (%s) is exists on container:%s' , $ namespace , $ this -> getPath ( ) ) ) ; $ nestedCnt = $ container ; $ nestedCnt -> __nestLeft = $ this ; // set parent container $ nestedCnt -> setName ( $ namespace ) ; $ this -> __nestRight [ $ cNamespace ] = $ nestedCnt ; return $ this ; }
Nest A Container Within

@param Container $container
@param string|null $namespace Container Namespace

@return $this
@throws \Exception
Nest A Container Within