1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Entity.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Chat\Collab;
4
5use Bitrix\Im\V2\Common\ContextCustomer;
6use Bitrix\Im\V2\Rest\RestConvertible;
7use Bitrix\Main\Loader;
8use Bitrix\Main\LoaderException;
9use Bitrix\Socialnetwork\Collab\Link\LinkManager;
10use Bitrix\Socialnetwork\Collab\Link\LinkParts;
11use Bitrix\Socialnetwork\Collab\Link\LinkType;
12
13abstract class Entity implements RestConvertible
14{
15 use ContextCustomer;
16
17 protected int $groupId;
20
24 public function __construct(int $groupId)
25 {
26 Loader::requireModule('socialnetwork');
27 $this->groupId = $groupId;
28 $this->linkManager = LinkManager::getInstance();
29 $this->linkParts = new LinkParts($this->getContext()->getUserId(), $groupId);
30 }
31
32 public function toRestFormat(array $option = []): ?array
33 {
34 return [
35 'counter' => $this->getCounter(),
36 'url' => $this->getUrl(),
37 ];
38 }
39
40 public function getCounter(): int
41 {
42 if (!static::isAvailable())
43 {
44 return 0;
45 }
46
47 return $this->getCounterInternal();
48 }
49
50 public function getUrl(): string
51 {
52 if (!static::isAvailable())
53 {
54 return '';
55 }
56
57 return $this->getUrlInternal();
58 }
59
60 public function getUrlInternal(): string
61 {
62 return '/' . $this->linkManager->get($this->getLinkType(), $this->linkParts);
63 }
64
65 abstract protected function getLinkType(): LinkType;
66
67 abstract public function getCounterInternal(): int;
68
69 abstract public static function isAvailable(): bool;
70}
toRestFormat(array $option=[])
Определения Entity.php:32
LinkParts $linkParts
Определения Entity.php:19
__construct(int $groupId)
Определения Entity.php:24
LinkManager $linkManager
Определения Entity.php:18
static requireModule($moduleName)
Определения loader.php:174
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения ufield.php:9
$option
Определения options.php:1711