Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
legacycounterprovider.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed
;
4
5
use
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
;
6
use
Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface
;
7
8
class
LegacyCounterProvider
implements
ProviderInterface
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
}
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\LegacyCounterProvider
Definition
legacycounterprovider.php:9
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\LegacyCounterProvider\getValue
getValue(int $spaceId=0, array $metrics=[])
Definition
legacycounterprovider.php:23
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\LegacyCounterProvider\__construct
__construct(private int $userId)
Definition
legacycounterprovider.php:10
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\LegacyCounterProvider\getTotal
getTotal(int $spaceId=0)
Definition
legacycounterprovider.php:12
Bitrix\Socialnetwork\Integration\SocialNetwork\LiveFeed\LegacyCounterProvider\getAvailableMetrics
getAvailableMetrics()
Definition
legacycounterprovider.php:40
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
modules
socialnetwork
lib
integration
socialnetwork
livefeed
legacycounterprovider.php
Создано системой
1.10.0