Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
counterprovider.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed
;
4
5
use
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
;
6
use
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
;
7
use
Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface
;
8
9
class
CounterProvider
implements
ProviderInterface
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
}
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider
Definition
counterprovider.php:10
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\isCounted
isCounted()
Definition
counterprovider.php:13
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\getValue
getValue(int $spaceId=0, array $metrics=[])
Definition
counterprovider.php:28
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\__construct
__construct(private int $userId)
Definition
counterprovider.php:11
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\getTotal
getTotal(int $spaceId=0)
Definition
counterprovider.php:23
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\isEnabled
isEnabled()
Definition
counterprovider.php:18
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\CounterProvider\getAvailableMetrics
getAvailableMetrics()
Definition
counterprovider.php:45
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterDictionary\COUNTER_TOTAL
const COUNTER_TOTAL
Definition
counterdictionary.php:22
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
Definition
counter.php:12
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\getInstance
static getInstance($userId)
Definition
counter.php:32
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
Definition
dictionary.php:6
Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface
Definition
providerinterface.php:6
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed
Definition
counterfactory.php:3
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
modules
socialnetwork
lib
integration
socialnetwork
livefeed
counterprovider.php
Создано системой
1.10.0