1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
channel.php
См. документацию.
1<?php
2
4
7
8class Channel
9{
10 protected $id;
11 protected $userId;
12 protected $privateId;
13 protected $publicId;
15 protected $dateCreate;
16
17 public static function createWithTag(string $tag): Channel
18 {
19 $instance = new static();
21 $instance->publicId = \CPullChannel::GetNewChannelIdByTag($tag,'public');
22 $instance->dateCreate = new DateTime();
23
24 return $instance;
25 }
26
27 public static function createRandom(): Channel
28 {
29 $instance = new static();
31 $instance->publicId = \CPullChannel::GetNewChannelId('public');
32 $instance->dateCreate = new DateTime();
33
34 return $instance;
35 }
36
42 public static function getShared(): Channel
43 {
45 if (!$fields)
46 {
47 throw new SystemException("Public channel is empty");
48 }
49
50 return static::createWithFields($fields);
51 }
52
53 public static function createWithFields(array $fields): Channel
54 {
55 $instance = new static();
56 if (isset($fields['CHANNEL_ID']))
57 {
58 $instance->privateId = $fields['CHANNEL_ID'];
59 }
60 if (isset($fields['CHANNEL_PUBLIC_ID']))
61 {
62 $instance->publicId = $fields['CHANNEL_PUBLIC_ID'];
63 }
64 if (isset($fields['CHANNEL_TYPE']))
65 {
66 $instance->type = $fields['CHANNEL_TYPE'];
67 }
68 if (isset($fields['CHANNEL_DT']))
69 {
70 $instance->dateCreate = DateTime::createFromTimestamp($fields['CHANNEL_DT']);
71 }
72
73 return $instance;
74 }
75
76 public function getId(): ?int
77 {
78 return $this->id;
79 }
80
81 public function getUserId(): ?int
82 {
83 return $this->userId;
84 }
85
86 public function getPrivateId(): string
87 {
88 return $this->privateId;
89 }
90
91 public function getPublicId(): string
92 {
93 return $this->publicId;
94 }
95
96 public function getSignedPublicId(): string
97 {
98 return \CPullChannel::SignPublicChannel($this->publicId);
99 }
100
101 public function getType(): string
102 {
103 return $this->type;
104 }
105
106 public function getDateCreate(): DateTime
107 {
108 return $this->dateCreate;
109 }
110}
getUserId()
Определения channel.php:81
getId()
Определения channel.php:76
static getShared()
Определения channel.php:42
getDateCreate()
Определения channel.php:106
getSignedPublicId()
Определения channel.php:96
static createWithFields(array $fields)
Определения channel.php:53
static createRandom()
Определения channel.php:27
getType()
Определения channel.php:101
$dateCreate
Определения channel.php:15
static createWithTag(string $tag)
Определения channel.php:17
getPublicId()
Определения channel.php:91
getPrivateId()
Определения channel.php:86
static GetNewChannelIdByTag(string $tag, string $suffix='')
Определения pull_channel.php:25
const TYPE_PRIVATE
Определения pull_channel.php:9
static GetNewChannelId($suffix='')
Определения pull_channel.php:19
static GetShared($cache=true, $reOpen=false, $channelType=self::TYPE_SHARED)
Определения pull_channel.php:36
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения channel.php:3
$instance
Определения ps_b24_final.php:14
$fields
Определения yandex_run.php:501