1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ContextCustomer.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Common;
4
5
use Bitrix\Im\User;
6
use Bitrix\Im\V2\Service\Context;
7
11
trait
ContextCustomer
12
{
13
protected
?
Context
$context
=
null
;
14
20
public
function
withContext
(?
Context
$context
): self
21
{
22
$copy = clone $this;
23
24
return
$copy->setContext(
$context
);
25
}
26
32
public
function
withContextUser
(
$user
): self
33
{
34
if
($this->context)
35
{
36
$context
= clone
$this->context
;
37
}
38
else
39
{
40
$context
=
new
Context
;
41
}
42
43
if
(
$user
instanceof
User
||
$user
instanceof \
Bitrix
\
Im
\
V2
\
Entity
\
User
\
User
)
44
{
45
$context
->setUser(
$user
);
46
}
47
elseif
(is_numeric(
$user
))
48
{
49
$context
->setUserId((
int
)
$user
);
50
}
51
52
return
$this->
withContext
($context);
53
}
54
60
public
function
setContext
(?
Context
$context
): self
61
{
62
$this->context =
$context
;
63
64
return
$this;
65
}
66
67
public
function
setContextUser
(
$user
): self
68
{
69
$context
=
new
Context
;
70
71
if
(
$user
instanceof
User
||
$user
instanceof \
Bitrix
\
Im
\
V2
\
Entity
\
User
\
User
)
72
{
73
$context
->setUser(
$user
);
74
}
75
elseif
(is_numeric(
$user
))
76
{
77
$context
->setUserId((
int
)
$user
);
78
}
79
80
$this->context =
$context
;
81
82
return
$this;
83
}
84
89
public
function
getContext
():
Context
90
{
91
if
($this->context)
92
{
93
return
$this->context
;
94
}
95
96
return \Bitrix\Im\V2\Service\Locator::getContext();
97
}
98
}
$context
$context
Определения
csv_new_setup.php:223
Bitrix\Im\V2\Chat\User
Определения
OwnerService.php:2
Bitrix\Im\V2\Common\ContextCustomer
trait ContextCustomer
Определения
ContextCustomer.php:12
Bitrix\Im\V2\Common\withContext
withContext(?Context $context)
Определения
ContextCustomer.php:20
Bitrix\Im\V2\Common\withContextUser
withContextUser($user)
Определения
ContextCustomer.php:32
Bitrix\Im\V2\Common\setContextUser
setContextUser($user)
Определения
ContextCustomer.php:67
Bitrix\Im\V2\Common\getContext
getContext()
Определения
ContextCustomer.php:89
Bitrix\Im\V2\Common\setContext
setContext(?Context $context)
Определения
ContextCustomer.php:60
Bitrix\Im\V2
Определения
ActionUuid.php:3
Bitrix\Im
Bitrix\Main\Context
Определения
culture.php:9
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\$user
$user
Определения
mysql_to_pgsql.php:33
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
im
lib
V2
Common
ContextCustomer.php
Создано системой
1.14.0