1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ContextCustomer.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Common;
4
5use Bitrix\Im\User;
6use Bitrix\Im\V2\Service\Context;
7
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 {
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
Определения csv_new_setup.php:223
trait ContextCustomer
Определения ContextCustomer.php:12
withContext(?Context $context)
Определения ContextCustomer.php:20
withContextUser($user)
Определения ContextCustomer.php:32
setContextUser($user)
Определения ContextCustomer.php:67
getContext()
Определения ContextCustomer.php:89
setContext(?Context $context)
Определения ContextCustomer.php:60
Определения ActionUuid.php:3
Определения culture.php:9
Определения ufield.php:9
$user
Определения mysql_to_pgsql.php:33
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393