Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
excludeddatecomparemanager.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Event\Tools
;
4
5
use
Bitrix\Calendar\Core\Base\Date
;
6
use
Bitrix\Calendar\Core\Event\Properties\ExcludedDatesCollection
;
7
8
class
ExcludedDateCompareManager
9
{
13
protected
$originalCollection
;
17
protected
$currentCollection
;
21
protected
$isEqual
=
true
;
25
protected
$diff
= [];
26
32
public
static
function
createInstance
(?
ExcludedDatesCollection
$originalCollection
, ?
ExcludedDatesCollection
$currentCollection
):
ExcludedDateCompareManager
33
{
34
return
new
self
(
$originalCollection
,
$currentCollection
);
35
}
36
41
public
function
__construct
(?
ExcludedDatesCollection
$originalCollection
, ?
ExcludedDatesCollection
$currentCollection
)
42
{
43
$this->originalCollection =
$originalCollection
;
44
$this->currentCollection =
$currentCollection
;
45
}
46
50
public
function
compare
():
ExcludedDateCompareManager
51
{
52
$this->diff = array_udiff(
53
$this->currentCollection->getCollection(),
54
$this->originalCollection->getCollection(),
55
[$this,
'compareHandler'
]
56
);
57
58
if
(
59
$this->diff
60
|| $this->originalCollection->count() !== $this->currentCollection->count()
61
)
62
{
63
$this->
isEqual
=
false
;
64
}
65
66
return
$this;
67
}
68
72
public
function
getDiffCollection
():
ExcludedDatesCollection
73
{
74
return
new
ExcludedDatesCollection
($this->diff);
75
}
76
80
public
function
isEqual
(): bool
81
{
82
return
$this->isEqual
;
83
}
84
88
public
function
hasDiff
(): bool
89
{
90
return
(
bool
)
$this->diff
;
91
}
92
98
private
function
compareHandler(
Date
$current,
Date
$original): int
99
{
100
return
$current->
getTimestamp
() <=> $original->
getTimestamp
();
101
}
102
}
Bitrix\Calendar\Core\Base\Date
Definition
date.php:10
Bitrix\Calendar\Core\Base\Date\getTimestamp
getTimestamp()
Definition
date.php:129
Bitrix\Calendar\Core\Event\Properties\ExcludedDatesCollection
Definition
excludeddatescollection.php:10
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager
Definition
excludeddatecomparemanager.php:9
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\$diff
$diff
Definition
excludeddatecomparemanager.php:25
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\$isEqual
$isEqual
Definition
excludeddatecomparemanager.php:21
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\hasDiff
hasDiff()
Definition
excludeddatecomparemanager.php:88
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\createInstance
static createInstance(?ExcludedDatesCollection $originalCollection, ?ExcludedDatesCollection $currentCollection)
Definition
excludeddatecomparemanager.php:32
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\isEqual
isEqual()
Definition
excludeddatecomparemanager.php:80
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\__construct
__construct(?ExcludedDatesCollection $originalCollection, ?ExcludedDatesCollection $currentCollection)
Definition
excludeddatecomparemanager.php:41
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\$currentCollection
$currentCollection
Definition
excludeddatecomparemanager.php:17
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\getDiffCollection
getDiffCollection()
Definition
excludeddatecomparemanager.php:72
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\$originalCollection
$originalCollection
Definition
excludeddatecomparemanager.php:13
Bitrix\Calendar\Core\Event\Tools\ExcludedDateCompareManager\compare
compare()
Definition
excludeddatecomparemanager.php:50
Bitrix\Calendar\Core\Event\Tools
Definition
dictionary.php:3
modules
calendar
lib
core
event
tools
excludeddatecomparemanager.php
Создано системой
1.10.0