Page MenuHomeWickedGov Phorge

MockSearchResultSet.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

MockSearchResultSet.php

<?php
class MockSearchResultSet extends SearchResultSet {
/**
* @var SearchResultSet[][] Map from result type to list of results for
* that type.
*/
private $interwikiResults;
/**
* @param SearchResult[]|callable[] $results
* @param ISearchResultSet[][]|callable[][] $interwikiResults Map from result type
* to list of results for that type.
*/
public function __construct( array $results, array $interwikiResults = [] ) {
parent::__construct( false, false );
$this->results = $results;
$this->interwikiResults = $interwikiResults;
}
/** @inheritDoc */
public function numRows() {
return count( $this->results );
}
/** @inheritDoc */
public function hasInterwikiResults( $type = self::SECONDARY_RESULTS ) {
return (bool)( $this->interwikiResults[$type] ?? false );
}
/** @inheritDoc */
public function extractResults() {
$results = parent::extractResults();
foreach ( $results as &$result ) {
// Resolve deferred results; needed to work around T203279
if ( is_callable( $result ) ) {
$result = $result();
}
}
return $results;
}
/** @inheritDoc */
public function getInterwikiResults( $type = self::SECONDARY_RESULTS ) {
return $this->interwikiResults[$type] ?? [];
}
/** @inheritDoc */
public function getTotalHits() {
return $this->numRows();
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 18 2026, 03:13 (9 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
65/ac/bfc2d2ace5e8ec2e282d6d2fad2d
Default Alt Text
MockSearchResultSet.php (1 KB)

Event Timeline