public function remove(Node $node) { $index = $this->indexOf($node); if ($index !== false) { $this->children[$index]->parent = null; array_splice($this->children, $index, 1); } return $this; }