File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ A lot of new conviniences and a few bug fixes.
44* Added support for CLI argument syntax at Request constructor.
55* Added optional arguments to request constructor for a tag and a query.
66* Added Communicator::isSeekableStream() and made Communicator::sendWordFromStream() use it.
7- * Added ResponseCollection::end().
7+ * Added ResponseCollection::prev() and ResponseCollection:: end().
88* Changed the default value of the $value of Message::setArgument from NULL to an empty string.
99* Changed ResponseCollection::getLast() to return FALSE when the collection is empty.
1010* Changed Request::setArgument() so that any invalid value is casted to string.
Original file line number Diff line number Diff line change @@ -219,6 +219,18 @@ public function current()
219219 return $ this ->valid () ? $ this ->responses [$ this ->position ] : false ;
220220 }
221221
222+ /**
223+ * Moves the pointer backwards by 1, and gets the previous response.
224+ *
225+ * @return Response The next {@link Response} object, or FALSE if the
226+ * position is not valid.
227+ */
228+ public function prev ()
229+ {
230+ --$ this ->position ;
231+ return $ this ->current ();
232+ }
233+
222234 /**
223235 * Moves the pointer to the last valid position, and returns the last
224236 * response.
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ public function testSendSyncReturningCollection()
3434 __NAMESPACE__ . '\Response ' , $ list ->end (),
3535 'The list is empty '
3636 );
37+ $ this ->assertEquals (Response::TYPE_FINAL , $ list ->current ()->getType ());
38+ $ this ->assertInstanceOf (
39+ __NAMESPACE__ . '\Response ' , $ list ->prev (),
40+ 'The list is empty '
41+ );
42+ $ this ->assertEquals (Response::TYPE_DATA , $ list ->current ()->getType ());
3743 }
3844
3945 public function testSendSyncReturningCollectionWithStreams ()
You can’t perform that action at this time.
0 commit comments