original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Add a component to the component tree
  
  @param string $componentId  Component ID
  @param array $componentPath Component path
  @param array $tree          Component base tree
docstring_tokens: Add a component to the component tree