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.
4
4
* Added support for CLI argument syntax at Request constructor.
5
5
* Added optional arguments to request constructor for a tag and a query.
6
6
* Added Communicator::isSeekableStream() and made Communicator::sendWordFromStream() use it.
7
- * Added ResponseCollection::end().
7
+ * Added ResponseCollection::prev() and ResponseCollection:: end().
8
8
* Changed the default value of the $value of Message::setArgument from NULL to an empty string.
9
9
* Changed ResponseCollection::getLast() to return FALSE when the collection is empty.
10
10
* 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()
219
219
return $ this ->valid () ? $ this ->responses [$ this ->position ] : false ;
220
220
}
221
221
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
+
222
234
/**
223
235
* Moves the pointer to the last valid position, and returns the last
224
236
* response.
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ public function testSendSyncReturningCollection()
34
34
__NAMESPACE__ . '\Response ' , $ list ->end (),
35
35
'The list is empty '
36
36
);
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 ());
37
43
}
38
44
39
45
public function testSendSyncReturningCollectionWithStreams ()
You can’t perform that action at this time.
0 commit comments