1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Context.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Service;
4
5
use Bitrix\Im\V2\Entity\User\User;
6
7
class
Context
8
{
9
protected
?
int
$actionContextUserId
=
null
;
10
16
public
function
setUser
($contextUser): self
17
{
18
if
(is_numeric($contextUser))
19
{
20
$this->
setUserId
((
int
)$contextUser);
21
}
22
elseif
($contextUser instanceof
User
)
23
{
24
$this->
setUserId
($contextUser->getId());
25
}
26
elseif
($contextUser instanceof \
Bitrix
\
Im
\
User
)
27
{
28
$this->
setUserId
($contextUser->getId());
29
}
30
elseif
($contextUser ===
null
)
31
{
32
$this->
resetUser
();
33
}
34
35
return
$this;
36
}
37
45
public
function
setUserId
(?
int
$contextUserId): self
46
{
47
if
(is_numeric($contextUserId))
48
{
49
$this->actionContextUserId = (int)$contextUserId;
50
}
51
elseif
($contextUserId ===
null
)
52
{
53
$this->
resetUser
();
54
}
55
56
return
$this;
57
}
58
63
public
function
resetUser
(): self
64
{
65
$this->actionContextUserId =
null
;
66
67
return
$this;
68
}
69
74
public
function
getUserId
(): int
75
{
76
global
$USER
;
77
if
(
78
$this->actionContextUserId ===
null
79
&& (
$USER
instanceof \CUser)
80
)
81
{
82
return
(
int
)
$USER
->getId();
83
}
84
85
return
(
int
)$this->actionContextUserId;
86
}
87
92
public
function
getUser
():
User
93
{
94
return
User::getInstance
($this->
getUserId
());
95
}
96
}
Bitrix\Im\User\getInstance
static getInstance($userId=null)
Определения
user.php:45
Bitrix\Im\V2\Service\Context\getUserId
getUserId()
Определения
Context.php:74
Bitrix\Im\V2\Service\Context\setUserId
setUserId(?int $contextUserId)
Определения
Context.php:45
Bitrix\Im\V2\Service\Context\$actionContextUserId
int $actionContextUserId
Определения
Context.php:9
Bitrix\Im\V2\Service\Context\setUser
setUser($contextUser)
Определения
Context.php:16
Bitrix\Im\V2\Service\Context\resetUser
resetUser()
Определения
Context.php:63
Bitrix\Im\V2\Service\Context\getUser
getUser()
Определения
Context.php:92
$USER
global $USER
Определения
csv_new_run.php:40
Bitrix\Im\V2\Chat\User
Определения
OwnerService.php:2
Bitrix\Im
Bitrix\Main\Context
Определения
culture.php:9
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
im
lib
V2
Service
Context.php
Создано системой
1.14.0