Debian Codegraph @

tests/phpunit/includes/specials/SpecialSearchTestMockResultSet.php

raw symbols SCIP
1 <?php
2
3 class SpecialSearchTestMockResultSet extends SearchResultSet {
4 /** @var array */
5 protected $results;
6 /** @var string|null */
7 protected $suggestion;
8 /** @var string|null */
9 protected $rewrittenQuery;
10 /** @var bool */
11 protected $containedSyntax;
12
13 public function __construct(
14 $suggestion = null,
15 $rewrittenQuery = null,
16 array $results = [],
17 $containedSyntax = false
18 ) {
19 $this->suggestion = $suggestion;
20 $this->rewrittenQuery = $rewrittenQuery;
21 $this->results = $results;
22 $this->containedSyntax = $containedSyntax;
23 }
24
25 public function expandResults() {
26 return $this->results;
27 }
28
29 public function getTotalHits() {
30 return $this->numRows();
31 }
32
33 public function hasSuggestion() {
34 return $this->suggestion !== null;
35 }
36
37 public function getSuggestionQuery() {
38 return $this->suggestion;
39 }
40
41 public function getSuggestionSnippet() {
42 return $this->suggestion;
43 }
44
45 public function hasRewrittenQuery() {
46 return $this->rewrittenQuery !== null;
47 }
48
49 public function getQueryAfterRewrite() {
50 return $this->rewrittenQuery;
51 }
52
53 public function getQueryAfterRewriteSnippet() {
54 return htmlspecialchars( $this->rewrittenQuery );
55 }
56
57 public function getFirstResult() {
58 if ( count( $this->results ) === 0 ) {
59 return null;
60 }
61 return $this->results[0]->getTitle();
62 }
63 }