MediaWiki REL1_35
FauxSearchResultSet.php
Go to the documentation of this file.
1<?php
2
9
14 private $totalHits;
15
20 public function __construct( array $results, $totalHits = null ) {
23 parent::__construct( false, $hasMoreResults );
24 $this->results = array_map( function ( $result ) {
25 if ( $result instanceof SearchResult ) {
26 return $result;
27 } elseif ( $result instanceof Title ) {
28 return new FauxSearchResult( $result );
29 } else {
30 throw new InvalidArgumentException( '$results must contain Title or SearchResult' );
31 }
32 }, $results );
33 $this->totalHits = $totalHits;
34 }
35
37 public function getTotalHits() {
38 return $this->totalHits;
39 }
40
41}
A manually constructed search result set.
__construct(array $results, $totalHits=null)
getTotalHits()
Some search modes return a total hit count for the query in the entire article database....
A manually constructed search result, for use with FauxSearchResultSet.
boolean $hasMoreResults
True when there are more pages of search results available.
SearchResult[] $results
Cache of results - serialization of the result iterator as an array.
NOTE: this class is being refactored into an abstract base class.
Represents a title within MediaWiki.
Definition Title.php:42