本文整理汇总了PHP中tree::addChild方法的典型用法代码示例。如果您正苦于以下问题:PHP tree::addChild方法的具体用法?PHP tree::addChild怎么用?PHP tree::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree
的用法示例。
在下文中一共展示了tree::addChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_children_from_do
private function get_children_from_do($tokens, &$start, $parent_node, &$last_node, $foroutput = false)
{
$tree = new tree();
$current_node_id = $parent_node;
$tp = $start;
$tree = new tree();
if (!($temp = $this->search_token($tokens, $start, '{', array(';')))) {
return false;
}
$start = $temp;
$end = $this->get_pair($tokens, $start);
$this->break_levels[] = $end;
$new_node = $current_node_id = $current_node_id + 1;
if (!in_array($parent_node, array_merge($this->break_nodes, $this->continue_nodes, $this->return_nodes))) {
$tree->addChild($parent_node, $new_node);
}
$this->add_tokens_to_be_inserted_after($start + 1, "/*{$new_node}*/" . "\\codespy\\Analyzer::\$executionbranches[__FILE__][__CLASS__][__FUNCTION__][\\codespy\\Analyzer::\$instancenumberfor[__FILE__][__CLASS__][__FUNCTION__]][{$new_node}] = 1;", $foroutput ? $new_node : false);
if ($children = $this->get_children_from($tokens, $start, $end, $current_node_id, $current_node_id, $foroutput)) {
$tree->addChildren($children);
}
$tp = $end + 1;
$tp = $this->search_token($tokens, $tp, '(');
$end = $this->get_pair($tokens, $tp) + 1;
$new_node = $current_node_id + 1;
if (!in_array($parent_node, $this->break_nodes)) {
$tree->addChild($parent_node, $new_node);
}
$tree->addChildToAllLeavesOfParent($parent_node, $new_node, array_merge($this->break_nodes, $this->continue_nodes, $this->return_nodes));
if (isset($this->jumps[$end])) {
foreach ($this->jumps[$end] as $jn) {
$tree->addChild($jn, $new_node);
}
}
$this->add_tokens_to_be_inserted_after($end + 1, "/*{$new_node}*/" . "\\codespy\\Analyzer::\$executionbranches[__FILE__][__CLASS__][__FUNCTION__][\\codespy\\Analyzer::\$instancenumberfor[__FILE__][__CLASS__][__FUNCTION__]][{$new_node}] = 1;", $foroutput ? $new_node : false);
$last_node = $new_node;
$start = $end;
array_pop($this->break_levels);
return $tree;
}
示例2: tree
<?php
require_once '../thinkedit.init.php';
require_once ROOT . '/class/tree.class.php';
echo '<pre>';
$tree = new tree();
// we start at "root"
$tree->setNodeId(1);
$tree->addChild('article', 'table', '5');
foreach ($tree->getChildren() as $node) {
print_r($node);
}