Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
EntityResultSet
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 transformOneResult
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getElasticaResultSet
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 searchContainedSyntax
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Wikibase\Search\Elastic;
3
4use CirrusSearch\Search\BaseCirrusSearchResultSet;
5use Wikibase\Lib\TermLanguageFallbackChain;
6
7/**
8 * Result set for entity search
9 */
10class EntityResultSet extends BaseCirrusSearchResultSet {
11
12    /**
13     * Display fallback chain.
14     * @var TermLanguageFallbackChain
15     */
16    private $termFallbackChain;
17    /**
18     * Display language code
19     * @var string
20     */
21    private $displayLanguage;
22
23    /**
24     * @var \Elastica\ResultSet|null
25     */
26    private $result;
27
28    /**
29     * @param string $displayLanguage
30     * @param TermLanguageFallbackChain $displayFallbackChain
31     * @param \Elastica\ResultSet $result
32     */
33    public function __construct( $displayLanguage,
34        TermLanguageFallbackChain $displayFallbackChain,
35        \Elastica\ResultSet $result
36    ) {
37        $this->result = $result;
38        $this->termFallbackChain = $displayFallbackChain;
39        $this->displayLanguage = $displayLanguage;
40    }
41
42    protected function transformOneResult( \Elastica\Result $result ) {
43        return new EntityResult( $this->displayLanguage, $this->termFallbackChain, $result );
44    }
45
46    /**
47     * @return \Elastica\ResultSet|null
48     */
49    public function getElasticaResultSet() {
50        return $this->result;
51    }
52
53    /**
54     * Did the search contain search syntax?  If so, Special:Search won't offer
55     * the user a link to a create a page named by the search string because the
56     * name would contain the search syntax.
57     * @return bool
58     */
59    public function searchContainedSyntax() {
60        return false;
61    }
62
63}