Passed
Push — master ( 5f60a5...391298 )
by Timo
24:49
created

GroupItem::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1.0019

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 7
cts 8
cp 0.875
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 5
crap 1.0019
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 $numFound = 0;
48
49
    /**
50
     * @var int
51
     */
52
    protected $start = 0;
53
54
    /**
55
     * @var float
56
     */
57
    protected $maxScore = 0;
58
59
    /**
60
     * @var SearchResultCollection
61
     */
62
    protected $searchResults;
63
64
    /**
65
     * @param Group $group
66
     * @param string $groupValue
67
     * @param int $numFound
68
     * @param int $start
69
     * @param float $maxScore
70
     */
71 8
    public function __construct(Group $group, $groupValue, $numFound, $start, $maxScore)
72
    {
73 8
        $this->group = $group;
0 ignored issues
show
Bug Best Practice introduced by
The property group does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
74 8
        $this->groupValue = $groupValue;
75 8
        $this->numFound = $numFound;
76 8
        $this->start = $start;
77 8
        $this->maxScore = $maxScore;
78 8
        $this->searchResults = new SearchResultCollection();
79 8
    }
80
81
    /**
82
     * Get groupValue
83
     *
84
     * @return string
85
     */
86 1
    public function getGroupValue()
87
    {
88 1
        return $this->groupValue;
89
    }
90
91
    /**
92
     * Get numFound
93
     *
94
     * @return int
95
     */
96 1
    public function getNumFound()
97
    {
98 1
        return $this->numFound;
99
    }
100
101
    /**
102
     * Get start
103
     *
104
     * @return int
105
     */
106 1
    public function getStart()
107
    {
108 1
        return $this->start;
109
    }
110
111
    /**
112
     * Get maxScore
113
     *
114
     * @return float
115
     */
116 1
    public function getMaxScore()
117
    {
118 1
        return $this->maxScore;
119
    }
120
121
    /**
122
     * @return SearchResultCollection
123
     */
124 1
    public function getSearchResults(): SearchResultCollection
125
    {
126 1
        return $this->searchResults;
127
    }
128
129
    /**
130
     * @param SearchResultCollection $searchResults
131
     */
132
    public function setSearchResults(SearchResultCollection $searchResults)
133
    {
134
        $this->searchResults = $searchResults;
135
    }
136
137
    /**
138
     * @param SearchResult $searchResult
139
     */
140 1
    public function addSearchResult(SearchResult $searchResult)
141
    {
142 1
        $this->searchResults[] = $searchResult;
143 1
    }
144
145
    /**
146
     * @return Group
147
     */
148 1
    public function getGroup(): Group
149
    {
150 1
        return $this->group;
151
    }
152
}
153