public wrap ( string | |
||
$node | string | |
Wrapping node, string to create new element node |
$wrap_index | integer | Index to insert current node in wrapping node, -1 to append |
$node_index | integer | Index to insert wrapping node, null to keep at same position |
리턴 | Wrapping node |
function wrap($node, $wrap_index = -1, $node_index = null)
{
if ($node_index === null) {
$node_index = $this->index();
}
if (!is_object($node)) {
$node = $this->parent->addChild($node, $node_index);
} elseif ($node->parent !== $this->parent) {
$node->changeParent($this->parent, $node_index);
}
$this->changeParent($node, $wrap_index);
return $node;
}