/** * Add child to this node * * If the child already has a parent, the link is unset * * @param JNode $child The child to be added * * @return void * * @since 11.1 */ function addChild(&$child) { if ($child instanceof Jnode) { $child->setParent($this); } }
/** * Add child to this node * * If the child already has a parent, the link is unset * * @param JNode &$child The child to be added * * @return void * * @since 11.1 */ public function addChild(JNode &$child) { JLog::add('JNode::addChild() is deprecated.', JLog::WARNING, 'deprecated'); $child->setParent($this); }
/** * Tests setting the parent of a node. * * @group JNode * @covers JNode::setParent * @return void */ public function testSetParent() { $newParent = new JNode(); $this->object->setParent($newParent); $this->assertAttributeEquals($newParent, '_parent', $this->object); }