Passed
Push — master ( 1c0463...42d2d3 )
by Timo
05:11
created

AbstractFacetItem::getMetrics()   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
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
17
18
/**
19
 * Abstract item that represent a value of a facet. E.g. an option or a node
20
 *
21
 * @author Frans Saris <[email protected]>
22
 * @author Timo Hund <[email protected]>
23
 * @package ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\OptionsFacet
24
 */
25
abstract class AbstractFacetItem
26
{
27
    /**
28
     * @var string
29
     */
30
    protected $label = '';
31
32
    /**
33
     * @var int
34
     */
35
    protected $documentCount = 0;
36
37
    /**
38
     * @var bool
39
     */
40
    protected $selected = false;
41
42
    /**
43
     * @var array
44
     */
45
    protected $metrics = [];
46
47
    /**
48
     * @var AbstractFacet
49
     */
50
    protected $facet;
51
52
    /**
53 77
     * @param AbstractFacet $facet
54
     * @param string $label
55 77
     * @param int $documentCount
56 77
     * @param bool $selected
57 77
     * @param array $metrics
58 77
     */
59 77
    public function __construct(AbstractFacet $facet, $label = '', $documentCount = 0, $selected = false, $metrics = [])
60
    {
61
        $this->facet = $facet;
62
        $this->label = $label;
63
        $this->documentCount = $documentCount;
64 28
        $this->selected = $selected;
65
        $this->metrics = $metrics;
66 28
    }
67
68
    /**
69
     * @return int
70
     */
71
    public function getDocumentCount()
72
    {
73
        return $this->documentCount;
74
    }
75
76
    /**
77
     * @return \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\AbstractFacet
78
     */
79
    public function getFacet()
80 28
    {
81
        return $this->facet;
82 28
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function getLabel()
88 7
    {
89
        return $this->label;
90 7
    }
91
92
    /**
93
     * @return boolean
94
     */
95
    public function getSelected()
96
    {
97
        return $this->selected;
98
    }
99
100
    /**
101
     * @return array
102
     */
103
    public function getMetrics()
104
    {
105
        return $this->metrics;
106
    }
107
108
    /**
109
     * @return string
110
     */
111
    abstract public function getUriValue();
112
113
    /**
114
     * @return string
115
     */
116
    abstract function getCollectionKey();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
117
}
118