Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
remindcomparemanager.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Managers\Compare
;
4
5
use
Bitrix\Calendar\Core\Base\Property
;
6
use
Bitrix\Calendar\Core\Event\Properties\Remind
;
7
use
Bitrix\Calendar\Core\Event\Properties\RemindCollection
;
8
use
Bitrix\Calendar\Core\Event\Tools\PropertyException
;
9
10
class
RemindCompareManager
implements
CompareManager
11
{
15
protected
$currentCollection
;
19
protected
$originalCollection
;
23
protected
$diff
;
27
protected
$isEqual
=
true
;
28
33
public
function
__construct
(
RemindCollection
$currentCollection
,
RemindCollection
$originalCollection
)
34
{
35
$this->currentCollection =
$currentCollection
;
36
$this->originalCollection =
$originalCollection
;
37
38
$this->
compare
();
39
}
40
46
public
static
function
createInstance
(
47
RemindCollection
$currentCollection
,
48
RemindCollection
$originalCollection
49
):
RemindCompareManager
50
{
51
return
new
self
(
$currentCollection
,
$originalCollection
);
52
}
53
57
protected
function
compare
(): void
58
{
59
$this->diff = array_udiff(
60
$this->currentCollection->getCollection(),
61
$this->originalCollection->getCollection(),
62
[$this,
'compareHandler'
]
63
);
64
65
if
(
66
$this->diff
67
|| $this->originalCollection->count() !== $this->currentCollection->count()
68
)
69
{
70
$this->
isEqual
=
false
;
71
}
72
}
73
77
public
function
getDiff
(): array
78
{
79
return
$this->diff
;
80
}
81
85
public
function
hasDiff
(): bool
86
{
87
return
(
bool
)
$this->diff
;
88
}
89
93
public
function
getDiffCollection
():
RemindCollection
94
{
95
return
new
RemindCollection
($this->diff);
96
}
97
101
public
function
isEqual
(): bool
102
{
103
return
$this->isEqual
;
104
}
105
112
private
function
compareHandler(
Remind
$current,
Remind
$original): int
113
{
114
return
$current->
getSpecificTime
()->getTimestamp() <=> $original->
getSpecificTime
()->getTimestamp();
115
}
116
}
Bitrix\Calendar\Core\Event\Properties\RemindCollection
Definition
remindcollection.php:11
Bitrix\Calendar\Core\Event\Properties\Remind
Definition
remind.php:11
Bitrix\Calendar\Core\Event\Properties\Remind\getSpecificTime
getSpecificTime()
Definition
remind.php:117
Bitrix\Calendar\Core\Event\Tools\PropertyException
Definition
propertyexception.php:6
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager
Definition
remindcomparemanager.php:11
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\$diff
$diff
Definition
remindcomparemanager.php:23
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\$isEqual
$isEqual
Definition
remindcomparemanager.php:27
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\hasDiff
hasDiff()
Definition
remindcomparemanager.php:85
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\isEqual
isEqual()
Definition
remindcomparemanager.php:101
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\__construct
__construct(RemindCollection $currentCollection, RemindCollection $originalCollection)
Definition
remindcomparemanager.php:33
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\$currentCollection
$currentCollection
Definition
remindcomparemanager.php:15
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\getDiffCollection
getDiffCollection()
Definition
remindcomparemanager.php:93
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\getDiff
getDiff()
Definition
remindcomparemanager.php:77
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\createInstance
static createInstance(RemindCollection $currentCollection, RemindCollection $originalCollection)
Definition
remindcomparemanager.php:46
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\$originalCollection
$originalCollection
Definition
remindcomparemanager.php:19
Bitrix\Calendar\Core\Managers\Compare\RemindCompareManager\compare
compare()
Definition
remindcomparemanager.php:57
Bitrix\Calendar\Core\Base\Property
Definition
property.php:6
Bitrix\Calendar\Core\Managers\Compare\CompareManager
Definition
comparemanager.php:6
Bitrix\Calendar\Core\Managers\Compare
Definition
comparemanager.php:3
modules
calendar
lib
core
managers
compare
remindcomparemanager.php
Создано системой
1.10.0