Passed
Push — master ( ed38f6...30aafa )
by Timo
11:15
created

GroupItem::getMaxScore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A GroupItem::addSearchResult() 0 3 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
 * @package ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping
36
 */
37
class GroupItem
38
{
39
    /**
40
     * @var string
41
     */
42
    protected $groupValue = '';
43
44
    /**
45
     * @var int
46
     */
47
    protected $allResultCount = 0;
48
49
    /**
50
     * @var int
51
     */
52
    protected $start = 0;
53
54
    /**
55
     * @var float
56
     */
57
    protected $maximumScore = 0;
58
59
    /**
60
     * @var SearchResultCollection
61
     */
62
    protected $searchResults;
63
64
    /**
65
     * @var Group
66
     */
67
    protected $group;
68
69
    /**
70
     * @param Group $group
71
     * @param string $groupValue
72
     * @param int $numFound
73
     * @param int $start
74
     * @param float $maxScore
75
     */
76 9
    public function __construct(Group $group, $groupValue, $numFound, $start, $maxScore)
77
    {
78 9
        $this->group = $group;
79 9
        $this->groupValue = $groupValue;
80 9
        $this->allResultCount = $numFound;
81 9
        $this->start = $start;
82 9
        $this->maximumScore = $maxScore;
83 9
        $this->searchResults = new SearchResultCollection();
84 9
    }
85
86
    /**
87
     * Get groupValue
88
     *
89
     * @return string
90
     */
91 2
    public function getGroupValue()
92
    {
93 2
        return $this->groupValue;
94
    }
95
96
    /**
97
     * Get numFound
98
     *
99
     * @return int
100
     */
101 1
    public function getAllResultCount()
102
    {
103 1
        return $this->allResultCount;
104
    }
105
106
    /**
107
     * Get start
108
     *
109
     * @return int
110
     */
111
    public function getStart()
112
    {
113
        return $this->start;
114
    }
115
116
    /**
117
     * Get maxScore
118
     *
119
     * @return float
120
     */
121
    public function getMaximumScore()
122
    {
123 1
        return $this->maximumScore;
124
    }
125 1
126
    /**
127
     * @return SearchResultCollection
128
     */
129
    public function getSearchResults(): SearchResultCollection
130
    {
131
        return $this->searchResults;
132
    }
133 1
134
    /**
135 1
     * @param SearchResultCollection $searchResults
136
     */
137
    public function setSearchResults(SearchResultCollection $searchResults)
138
    {
139
        $this->searchResults = $searchResults;
140
    }
141
142
    /**
143
     * @param SearchResult $searchResult
144
     */
145
    public function addSearchResult(SearchResult $searchResult)
146
    {
147
        $this->searchResults[] = $searchResult;
148
    }
149
150
    /**
151
     * @return Group
152
     */
153
    public function getGroup(): Group
154 1
    {
155
        return $this->group;
156 1
    }
157
}
158