1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
counterprovider.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed;
4
5use Bitrix\Socialnetwork\Internals\LiveFeed\Counter;
6use Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary;
7use Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface;
8
10{
11 public function __construct(private int $userId) { }
12
13 public function isCounted(): bool
14 {
15 return Counter::getInstance($this->userId)->isCounted();
16 }
17
18 public function isEnabled(): bool
19 {
20 return Counter\CounterController::isEnabled($this->userId);
21 }
22
23 public function getTotal(int $spaceId = 0): int
24 {
25 return Counter::getInstance($this->userId)->get(Counter\CounterDictionary::COUNTER_TOTAL, $spaceId);
26 }
27
28 public function getValue(int $spaceId = 0, array $metrics = []): int
29 {
30 $result = 0;
31
32 foreach ($metrics as $metric)
33 {
34 switch ($metric)
35 {
36 case Dictionary::COUNTERS_LIVEFEED_TOTAL:
37 return $this->getTotal($spaceId);
38 //TODO: other cases...
39 }
40 }
41
42 return $result;
43 }
44
45 public function getAvailableMetrics(): array
46 {
47 return [
48 Dictionary::COUNTERS_LIVEFEED_TOTAL,
49 ];
50 }
51}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getInstance()
Определения application.php:98
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14