Completed
Push — master ( 9819c1...f2d6e9 )
by Rafael
06:19
created

GroupItem   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 116
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getGroupValue() 0 4 1
A getNumFound() 0 4 1
A getStart() 0 4 1
A getMaxScore() 0 4 1
A getSearchResults() 0 4 1
A setSearchResults() 0 4 1
A addSearchResult() 0 4 1
A getGroup() 0 4 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 2 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
    public function __construct(Group $group, $groupValue, $numFound, $start, $maxScore)
72
    {
73
        $this->group = $group;
0 ignored issues
show
Bug introduced by
The property group does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
74
        $this->groupValue = $groupValue;
75
        $this->numFound = $numFound;
76
        $this->start = $start;
77
        $this->maxScore = $maxScore;
78
        $this->searchResults = new SearchResultCollection();
79
    }
80
81
    /**
82
     * Get groupValue
83
     *
84
     * @return string
85
     */
86
    public function getGroupValue()
87
    {
88
        return $this->groupValue;
89
    }
90
91
    /**
92
     * Get numFound
93
     *
94
     * @return int
95
     */
96
    public function getNumFound()
97
    {
98
        return $this->numFound;
99
    }
100
101
    /**
102
     * Get start
103
     *
104
     * @return int
105
     */
106
    public function getStart()
107
    {
108
        return $this->start;
109
    }
110
111
    /**
112
     * Get maxScore
113
     *
114
     * @return float
115
     */
116
    public function getMaxScore()
117
    {
118
        return $this->maxScore;
119
    }
120
121
    /**
122
     * @return SearchResultCollection
123
     */
124
    public function getSearchResults(): SearchResultCollection
125
    {
126
        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
    public function addSearchResult(SearchResult $searchResult)
141
    {
142
        $this->searchResults[] = $searchResult;
143
    }
144
145
    /**
146
     * @return Group
147
     */
148
    public function getGroup(): Group
149
    {
150
        return $this->group;
151
    }
152
}
153