Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
legacycounterprovider.php
1<?php
2
4
7
9{
10 public function __construct(private int $userId) { }
11
12 public function getTotal(int $spaceId = 0): int
13 {
14 if ($spaceId === 0)
15 {
16 return \CUserCounter::GetValueByUserID($this->userId, SITE_ID, \CUserCounter::LIVEFEED_CODE);
17 }
18
19 // group livefeed
20 return 0;
21 }
22
23 public function getValue(int $spaceId = 0, array $metrics = []): int
24 {
25 $result = 0;
26
27 foreach ($metrics as $metric)
28 {
29 switch ($metric)
30 {
31 case Dictionary::COUNTERS_LIVEFEED_TOTAL:
32 return $this->getTotal($spaceId);
33 //TODO: other cases...
34 }
35 }
36
37 return $result;
38 }
39
40 public function getAvailableMetrics(): array
41 {
42 return [
43 Dictionary::COUNTERS_LIVEFEED_TOTAL,
44 ];
45 }
46}