Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
objectstatus.php
1
<?php
2
namespace
Bitrix\Calendar\Sync\Office365\Util
;
3
8
class
ObjectStatus
9
{
11
private
array $errors = [];
12
16
public
function
isSuccess
(): bool
17
{
18
return
empty($this->errors);
19
}
20
24
public
function
hasErrors
(): bool
25
{
26
return
!$this->
isSuccess
();
27
}
28
34
public
function
addError
(
string
$code,
string
$message)
35
{
36
$this->errors[] = [
37
'code'
=> $code,
38
'message'
=> $message,
39
];
40
}
41
45
public
function
resetErrors
()
46
{
47
$this->errors = [];
48
}
49
53
public
function
getErrors
(): array
54
{
55
return
$this->errors;
56
}
57
62
public
function
getErrorsByCode
(
string
$code): array
63
{
64
if
(!$this->
hasErrors
())
65
{
66
return
[];
67
}
68
69
return
array_filter($this->errors,
static
function
($error) use ($code)
70
{
71
return
$error[
'code'
] == $code;
72
});
73
}
74
79
public
function
getErrorByCode
(
string
$code): array
80
{
81
if
($filteredErrors = $this->
getErrorsByCode
($code))
82
{
83
return
end($filteredErrors);
84
}
85
86
return
[];
87
}
88
}
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus
Definition
objectstatus.php:9
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\isSuccess
isSuccess()
Definition
objectstatus.php:16
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\getErrors
getErrors()
Definition
objectstatus.php:53
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\getErrorByCode
getErrorByCode(string $code)
Definition
objectstatus.php:79
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\resetErrors
resetErrors()
Definition
objectstatus.php:45
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\addError
addError(string $code, string $message)
Definition
objectstatus.php:34
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\hasErrors
hasErrors()
Definition
objectstatus.php:24
Bitrix\Calendar\Sync\Office365\Util\ObjectStatus\getErrorsByCode
getErrorsByCode(string $code)
Definition
objectstatus.php:62
Bitrix\Calendar\Sync\Office365\Util
Definition
objectstatus.php:2
modules
calendar
lib
sync
office365
util
objectstatus.php
Создано системой
1.10.0