protected function addToComponentTree($componentId, array $componentPath, array &$tree)
    {
        // If the component has to be placed in a subpath
        if (count($componentPath)) {
            $subpath = array_shift($componentPath);
            if (empty($tree[$subpath])) {
                $tree[$subpath] = [];
            }
            $this->addToComponentTree($componentId, $componentPath, $tree[$subpath]);

            return;
        }

        $tree[] = $componentId;
    }
protected function addToComponentTree($componentId, array $componentPath, array &$tree)
    {
        // If the component has to be placed in a subpath
        if (count($componentPath)) {
            $subpath = array_shift($componentPath);
            if (empty($tree[$subpath])) {
                $tree[$subpath] = [];
            }
            $this->addToComponentTree($componentId, $componentPath, $tree[$subpath]);

            return;
        }

        $tree[] = $componentId;
    }
protected function addToComponentTree ( $ componentId , array $ componentPath , array & $ tree ) { // If the component has to be placed in a subpath if ( count ( $ componentPath ) ) { $ subpath = array_shift ( $ componentPath ) ; if ( empty ( $ tree [ $ subpath ] ) ) { $ tree [ $ subpath ] = [ ] ; } $ this -> addToComponentTree ( $ componentId , $ componentPath , $ tree [ $ subpath ] ) ; return ; } $ tree [ ] = $ componentId ; }
Add a component to the component tree

@param string $componentId  Component ID
@param array $componentPath Component path
@param array $tree          Component base tree
Add a component to the component tree