Prado\Xml\TXmlElementList::removeAt PHP Method

removeAt() public method

This overrides the parent implementation by performing additional cleanup work when removing a TXmlElement object.
public removeAt ( $index ) : mixed
return mixed the removed item.
    public function removeAt($index)
    {
        $item = parent::removeAt($index);
        if ($item instanceof TXmlElement) {
            $item->setParent(null);
        }
        return $item;
    }

Usage Example

Example #1
0
 public function testRemoveAt()
 {
     $element = new TXmlElement('tag');
     $list = new TXmlElementList($element);
     $newElement = new TXmlElement('newTag');
     $list->insertAt(0, $newElement);
     self::assertEquals($newElement, $list->removeAt(0));
 }