public function __toString() { $node = reset($this->collection); if ($node instanceof AbstractNode) { return (string) $node; } else { throw new EmptyCollectionException('The collection does not contain any Nodes.'); } }