3 * Overloads the relevant methods of the real ResultsWrapper so it
4 * doesn't go anywhere near an actual database.
6 class FakeResultWrapper
extends ResultWrapper
{
10 /** @var null And it's going to stay that way :D */
16 /** @var array|stdClass|bool */
17 protected $currentRow = null;
22 function __construct( $array ) {
23 $this->result
= $array;
30 return count( $this->result
);
37 if ( $this->pos
< count( $this->result
) ) {
38 $this->currentRow
= $this->result
[$this->pos
];
40 $this->currentRow
= false;
43 if ( is_object( $this->currentRow
) ) {
44 return get_object_vars( $this->currentRow
);
46 return $this->currentRow
;
50 function seek( $row ) {
58 * Callers want to be able to access fields with $this->fieldName
59 * @return bool|stdClass
61 function fetchObject() {
63 if ( $this->currentRow
) {
64 return (object)$this->currentRow
;
72 $this->currentRow
= null;
76 * @return bool|stdClass
79 return $this->fetchObject();