1 | <?php |
||
25 | class ContentList implements ContentListInterface |
||
26 | { |
||
27 | use TimestampableTrait, SoftDeletableTrait, EnableableTrait; |
||
28 | |||
29 | /** |
||
30 | * @var mixed |
||
31 | */ |
||
32 | protected $id; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $name; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $description; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $type; |
||
48 | |||
49 | /** |
||
50 | * @var int |
||
51 | */ |
||
52 | protected $cacheLifeTime; |
||
53 | |||
54 | /** |
||
55 | * @var int |
||
56 | */ |
||
57 | protected $limit; |
||
58 | |||
59 | /** |
||
60 | * @var Collection|ContentListItemInterface[] |
||
61 | */ |
||
62 | protected $items; |
||
63 | |||
64 | /** |
||
65 | * @var array |
||
66 | */ |
||
67 | protected $filters = []; |
||
68 | |||
69 | /** |
||
70 | * ContentList constructor. |
||
71 | */ |
||
72 | 17 | public function __construct() |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 14 | public function getId() |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 12 | public function getName() |
|
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | 17 | public function setName(string $name) |
|
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | 12 | public function getDescription() |
|
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | 13 | public function setDescription(string $description = null) |
|
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | 12 | public function getType() |
|
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | 16 | public function setType(string $type) |
|
133 | |||
134 | /** |
||
135 | * {@inheritdoc} |
||
136 | */ |
||
137 | 12 | public function getCacheLifeTime() |
|
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | 13 | public function setCacheLifeTime(int $cacheLifeTime = 0) |
|
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | 12 | public function getLimit() |
|
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | 13 | public function setLimit(int $limit = 0) |
|
165 | |||
166 | /** |
||
167 | * {@inheritdoc} |
||
168 | */ |
||
169 | 2 | public function getItems() |
|
170 | { |
||
171 | 2 | return $this->items; |
|
172 | } |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function setItems($items) |
||
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | */ |
||
185 | 2 | public function addItem(ContentListItemInterface $item) |
|
186 | { |
||
187 | 2 | if (!$this->items->contains($item)) { |
|
188 | 2 | $item->setContentList($this); |
|
189 | 2 | $this->items->add($item); |
|
190 | } |
||
191 | 2 | } |
|
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function removeItem(ContentListItemInterface $item) |
||
203 | |||
204 | /** |
||
205 | * {@inheritdoc} |
||
206 | */ |
||
207 | 12 | public function getFilters() |
|
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | */ |
||
215 | 8 | public function setFilters(array $filters) |
|
219 | |||
220 | /** |
||
221 | * {@inheritdoc} |
||
222 | */ |
||
223 | public function getFilter(string $key) |
||
231 | } |
||
232 |