Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
registry.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Queue\Rule
;
4
5
use
Bitrix\Calendar\Core\Queue\Exception\InvalidRuleException
;
6
use
Bitrix\Calendar\Core\Queue\Interfaces\RouteRule
;
7
use
Bitrix\Calendar\Core\Queue\Rule\Rules\EventAttendeesUpdateRule
;
8
use
Bitrix\Calendar\Core\Queue\Rule\Rules\EventDelayedSyncRule
;
9
use
Bitrix\Calendar\Core\Queue\Rule\Rules\EventWithEntityAttendeesFindRule
;
10
use
Bitrix\Calendar\Core\Queue\Rule\Rules\PushDelayedRule
;
11
use Bitrix\Calendar\Core\Base\SingletonTrait;
12
use
Bitrix\Calendar\Core\Queue\Rule\Rules\SendingEmailNotificationRule
;
13
14
class
Registry
15
{
16
use SingletonTrait;
17
18
private
array $rules = [];
19
20
protected
function
__construct
()
21
{
22
$this->
registerRule
(
new
EventDelayedSyncRule
());
23
$this->
registerRule
(
new
PushDelayedRule
());
24
$this->
registerRule
(
new
EventAttendeesUpdateRule
());
25
$this->
registerRule
(
new
EventWithEntityAttendeesFindRule
());
26
$this->
registerRule
(
new
SendingEmailNotificationRule
());
27
}
28
34
public
function
registerRule
(
RouteRule
$rule): self
35
{
36
$this->rules[] = $rule;
37
38
return
$this;
39
}
40
48
public
function
registerRuleClass
(
string
$className): self
49
{
50
if
(class_exists($className))
51
{
52
$rule =
new
$className();
53
if
($rule instanceof
RouteRule
)
54
{
55
$this->
registerRule
($rule);
56
}
57
else
58
{
59
throw
InvalidRuleException::classIsNotRule();
60
}
61
}
62
else
63
{
64
throw
InvalidRuleException::classIsInvalid(404);
65
}
66
67
return
$this;
68
}
69
73
public
function
getRules
(): array
74
{
75
return
$this->rules;
76
}
77
}
Bitrix\Calendar\Core\Queue\Exception\InvalidRuleException
Definition
invalidruleexception.php:7
Bitrix\Calendar\Core\Queue\QueueListener\Registry
Definition
registry.php:16
Bitrix\Calendar\Core\Queue\Rule\Registry\__construct
__construct()
Definition
registry.php:20
Bitrix\Calendar\Core\Queue\Rule\Registry\getRules
getRules()
Definition
registry.php:73
Bitrix\Calendar\Core\Queue\Rule\Registry\registerRule
registerRule(RouteRule $rule)
Definition
registry.php:34
Bitrix\Calendar\Core\Queue\Rule\Registry\registerRuleClass
registerRuleClass(string $className)
Definition
registry.php:48
Bitrix\Calendar\Core\Queue\Rule\Rules\EventAttendeesUpdateRule
Definition
eventattendeesupdaterule.php:10
Bitrix\Calendar\Core\Queue\Rule\Rules\EventDelayedSyncRule
Definition
eventdelayedsyncrule.php:10
Bitrix\Calendar\Core\Queue\Rule\Rules\EventWithEntityAttendeesFindRule
Definition
eventwithentityattendeesfindrule.php:10
Bitrix\Calendar\Core\Queue\Rule\Rules\PushDelayedRule
Definition
pushdelayedrule.php:12
Bitrix\Calendar\Core\Queue\Rule\Rules\SendingEmailNotificationRule
Definition
sendingemailnotificationrule.php:10
Bitrix\Calendar\Core\Queue\Interfaces\RouteRule
Definition
routerule.php:8
Bitrix\Calendar\Core\Queue\Rule
Definition
registry.php:3
modules
calendar
lib
core
queue
rule
registry.php
Создано системой
1.10.0