Passed
Push — master ( d4f966...dddccf )
by Rafael
34:04 queued 25:52
created

GroupItem::getGroupValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2017 Timo Hund <[email protected]>
8
 *  All rights reserved
9
 *
10
 *  This script is part of the TYPO3 project. The TYPO3 project is
11
 *  free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 3 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  The GNU General Public License can be found at
17
 *  http://www.gnu.org/copyleft/gpl.html.
18
 *
19
 *  This script is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  This copyright notice MUST APPEAR in all copies of the script!
25
 ***************************************************************/
26
27
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResult;
28
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResultCollection;
29
30
/**
31
 * Class GroupItem
32
 *
33
 * @author Frans Saris <[email protected]>
34
 * @author Timo Hund <[email protected]>
35
 */
36
class GroupItem
37
{
38
    /**
39
     * @var string
40
     */
41
    protected $groupValue = '';
42
43
    /**
44
     * @var int
45
     */
46
    protected $allResultCount = 0;
47
48
    /**
49
     * @var int
50
     */
51
    protected $start = 0;
52
53
    /**
54
     * @var float
55
     */
56
    protected $maximumScore = 0;
57
58
    /**
59
     * @var SearchResultCollection
60
     */
61
    protected $searchResults;
62
63
    /**
64
     * @var Group
65
     */
66
    protected $group;
67
68
    /**
69
     * @param Group $group
70
     * @param string $groupValue
71
     * @param int $numFound
72
     * @param int $start
73
     * @param float $maxScore
74
     */
75 9
    public function __construct(Group $group, $groupValue, $numFound, $start, $maxScore)
76
    {
77 9
        $this->group = $group;
78 9
        $this->groupValue = $groupValue;
79 9
        $this->allResultCount = $numFound;
80 9
        $this->start = $start;
81 9
        $this->maximumScore = $maxScore;
82 9
        $this->searchResults = new SearchResultCollection();
83 9
    }
84
85
    /**
86
     * Get groupValue
87
     *
88
     * @return string
89
     */
90 2
    public function getGroupValue()
91
    {
92 2
        return $this->groupValue;
93
    }
94
95
    /**
96
     * Get numFound
97
     *
98
     * @return int
99
     */
100 1
    public function getAllResultCount()
101
    {
102 1
        return $this->allResultCount;
103
    }
104
105
    /**
106
     * Get start
107
     *
108
     * @return int
109
     */
110 1
    public function getStart()
111
    {
112 1
        return $this->start;
113
    }
114
115
    /**
116
     * Get maxScore
117
     *
118
     * @return float
119
     */
120 1
    public function getMaximumScore()
121
    {
122 1
        return $this->maximumScore;
123
    }
124
125
    /**
126
     * @return SearchResultCollection
127
     */
128 1
    public function getSearchResults(): SearchResultCollection
129
    {
130 1
        return $this->searchResults;
131
    }
132
133
    /**
134
     * @param SearchResultCollection $searchResults
135
     */
136
    public function setSearchResults(SearchResultCollection $searchResults)
137
    {
138
        $this->searchResults = $searchResults;
139
    }
140
141
    /**
142
     * @param SearchResult $searchResult
143
     */
144 1
    public function addSearchResult(SearchResult $searchResult)
145
    {
146 1
        $this->searchResults[] = $searchResult;
147 1
    }
148
149
    /**
150
     * @return Group
151
     */
152 2
    public function getGroup(): Group
153
    {
154 2
        return $this->group;
155
    }
156
}
157