public function offsetSet($offset, $value) { if (!$value instanceof Entry) { throw new RuntimeException('The value is not of type Entry'); } $this->addChild($value); }