Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 12
TitleResultsType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
90
0.00% covered (danger)
0.00%
0 / 12
 __construct
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 2
 getStoredFields
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getHighlightingConfiguration
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 transformElasticsearchResult
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 4
 createEmptyResult
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getTitleHelper
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 3
<?php
namespace CirrusSearch\Search;
use Elastica\ResultSet as ElasticaResultSet;
/**
 * Returns titles and makes no effort to figure out how the titles matched.
 */
class TitleResultsType extends BaseResultsType {
    /**
     * @var TitleHelper
     */
    private $titleHelper;
    public function __construct( TitleHelper $titleHelper = null ) {
        $this->titleHelper = $titleHelper ?: new TitleHelper();
    }
    /**
     * @return array corresponding to Elasticsearch fields syntax
     */
    public function getStoredFields() {
        return [];
    }
    /**
     * @param array $extraHighlightFields
     * @return array|null
     */
    public function getHighlightingConfiguration( array $extraHighlightFields = [] ) {
        return null;
    }
    /**
     * @param ElasticaResultSet $resultSet
     * @return mixed Set of search results, the types of which vary by implementation.
     */
    public function transformElasticsearchResult( ElasticaResultSet $resultSet ) {
        $results = [];
        foreach ( $resultSet->getResults() as $r ) {
            $results[] = $this->getTitleHelper()->makeTitle( $r );
        }
        return $results;
    }
    /**
     * @return array
     */
    public function createEmptyResult() {
        return [];
    }
    /**
     * @return TitleHelper
     */
    public function getTitleHelper(): TitleHelper {
        if ( $this->titleHelper === null ) {
            $this->titleHelper = new TitleHelper();
        }
        return $this->titleHelper;
    }
}