SearchResultSetTrait::setTotalItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Trait SearchResultSetTrait|Firesphere\SolrSearch\Traits\SearchResultSetTrait Setters for
4
 * {@link \Firesphere\SolrSearch\Results\SearchResult}
5
 *
6
 * @package Firesphere\Solr\Search
7
 * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo
8
 * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy
9
 */
10
11
namespace Firesphere\SolrSearch\Traits;
12
13
use Firesphere\SolrSearch\Results\SearchResult;
14
use SilverStripe\View\ArrayData;
15
use Solarium\Component\Result\Highlighting\Highlighting;
16
17
/**
18
 * Trait SearchResultSetTrait
19
 *
20
 * Getters for search results to keep the {@link SearchResult} class clean.
21
 *
22
 * @package Firesphere\Solr\Search
23
 */
24
trait SearchResultSetTrait
25
{
26
    /**
27
     * @var int Total items in result
28
     */
29
    protected $totalItems;
30
    /**
31
     * @var ArrayData Facets
32
     */
33
    protected $facets;
34
35
    /**
36
     * @var Highlighting Highlighted items
37
     */
38
    protected $highlight;
39
40
    /**
41
     * Set the highlighted items
42
     *
43
     * @param $highlight
44
     * @return SearchResult
45
     */
46 6
    public function setHighlight($highlight): self
47
    {
48 6
        $this->highlight = $highlight;
49
50 6
        return $this;
51
    }
52
53
    /**
54
     * Set the total amount of results
55
     *
56
     * @param $count
57
     * @return self
58
     */
59 6
    public function setTotalItems($count): self
60
    {
61 6
        $this->totalItems = $count;
62
63 6
        return $this;
64
    }
65
}
66