1 | <?php |
||
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 | * @param AbstractFacet $facet |
||
54 | * @param string $label |
||
55 | * @param int $documentCount |
||
56 | * @param bool $selected |
||
57 | * @param array $metrics |
||
58 | */ |
||
59 | 83 | public function __construct(AbstractFacet $facet, $label = '', $documentCount = 0, $selected = false, $metrics = []) |
|
60 | { |
||
61 | 83 | $this->facet = $facet; |
|
62 | 83 | $this->label = $label; |
|
63 | 83 | $this->documentCount = $documentCount; |
|
64 | 83 | $this->selected = $selected; |
|
65 | 83 | $this->metrics = $metrics; |
|
66 | 83 | } |
|
67 | |||
68 | /** |
||
69 | * @return int |
||
70 | */ |
||
71 | 29 | public function getDocumentCount() |
|
72 | { |
||
73 | 29 | return $this->documentCount; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\AbstractFacet |
||
78 | */ |
||
79 | public function getFacet() |
||
80 | { |
||
81 | return $this->facet; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return string |
||
86 | */ |
||
87 | 34 | public function getLabel() |
|
91 | |||
92 | /** |
||
93 | * @return boolean |
||
94 | */ |
||
95 | 12 | public function getSelected() |
|
96 | { |
||
97 | 12 | 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(); |
||
117 | } |
||
118 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.