From f33adafab717a0244aa964a15aa55b90f6bdd436 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 1 Mar 2005 23:44:05 +0000 Subject: [PATCH] - Update docu --- ext/spl/internal/seekableiterator.inc | 17 ++++++++++++----- ext/spl/spl.php | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ext/spl/internal/seekableiterator.inc b/ext/spl/internal/seekableiterator.inc index 586be27a7bc..c00d264a952 100755 --- a/ext/spl/internal/seekableiterator.inc +++ b/ext/spl/internal/seekableiterator.inc @@ -25,17 +25,24 @@ interface SeekableIterator implements Iterator * \param $index position to seek to * \return void * - * \note The method should throw an exception if it is not possible to - * seek to the given position. - */ + * The method should throw an exception if it is not possible to seek to + * the given position. Typically this exception should be of type + * OutOfBoundsException. + \code function seek($index); -/* $this->rewind(); + $this->rewind(); $position = 0; while($position < $index && $this->valid()) { $this->next(); $position++; } - }*/ + if (!$this->valid()) { + throw new OutOfBoundsException('Invalid seek position'); + } + } + \endcode + */ + function seek($index); } ?> \ No newline at end of file diff --git a/ext/spl/spl.php b/ext/spl/spl.php index dcf10f0c210..b3c699a4d26 100755 --- a/ext/spl/spl.php +++ b/ext/spl/spl.php @@ -548,6 +548,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable function getArrayCopy(); /** @param $position offset to seek to + * @throw OutOfBoundsException if $position is invalid */ function seek($position);