original_string: protected static function build_tree($all, $parentid) {
          $tree = array();
          foreach ($all as $one) {
              if ($one->get('parentid') == $parentid) {
                  $node = new stdClass();
                  $node->competency = $one;
                  $node->children = self::build_tree($all, $one->get('id'));
                  $tree[] = $node;
              }
          }
          return $tree;
      }
code: protected static function build_tree($all, $parentid) {
          $tree = array();
          foreach ($all as $one) {
              if ($one->get('parentid') == $parentid) {
                  $node = new stdClass();
                  $node->competency = $one;
                  $node->children = self::build_tree($all, $one->get('id'));
                  $tree[] = $node;
              }
          }
          return $tree;
      }
code_tokens: protected static function build_tree ( $ all , $ parentid ) { $ tree = array ( ) ; foreach ( $ all as $ one ) { if ( $ one -> get ( 'parentid' ) == $ parentid ) { $ node = new stdClass ( ) ; $ node -> competency = $ one ; $ node -> children = self :: build_tree ( $ all , $ one -> get ( 'id' ) ) ; $ tree [ ] = $ node ; } } return $ tree ; }
docstring: Recursively build up the tree of nodes.
  
  @param array $all - List of all competency classes.
  @param int $parentid - The current parent ID. Pass 0 to build the tree from the top.
  @return node[] $tree tree of nodes
docstring_tokens: Recursively build up the tree of nodes .