Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / includes / libs / rdbms / database / resultwrapper / FakeResultWrapper.php
blob1a046cf696620d86672970ddf9423f5ac8f6fa6c
1 <?php
2 /**
3 * Overloads the relevant methods of the real ResultsWrapper so it
4 * doesn't go anywhere near an actual database.
5 */
6 class FakeResultWrapper extends ResultWrapper {
7 /** @var $result stdClass[] */
9 /**
10 * @param stdClass[] $rows
12 function __construct( array $rows ) {
13 parent::__construct( null, $rows );
16 function numRows() {
17 return count( $this->result );
20 function fetchRow() {
21 if ( $this->pos < count( $this->result ) ) {
22 $this->currentRow = $this->result[$this->pos];
23 } else {
24 $this->currentRow = false;
26 $this->pos++;
27 if ( is_object( $this->currentRow ) ) {
28 return get_object_vars( $this->currentRow );
29 } else {
30 return $this->currentRow;
34 function seek( $row ) {
35 $this->pos = $row;
38 function free() {
41 function fetchObject() {
42 $this->fetchRow();
43 if ( $this->currentRow ) {
44 return (object)$this->currentRow;
45 } else {
46 return false;
50 function rewind() {
51 $this->pos = 0;
52 $this->currentRow = null;
55 function next() {
56 return $this->fetchObject();