Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
objectstatus.php
1
<?php
2
namespace
Bitrix\Calendar\Internals
;
3
8
class
ObjectStatus
9
{
11
private
$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
return
[];
66
}
67
68
return
array_filter($this->errors,
function
($error) use ($code)
69
{
70
return
$error[
'code'
] == $code;
71
});
72
}
73
78
public
function
getErrorByCode
(
string
$code): array
79
{
80
if
($filtredErrors = $this->
getErrorsByCode
($code))
81
{
82
return
end($filtredErrors);
83
}
84
85
return
[];
86
}
87
}
Bitrix\Calendar\Internals\ObjectStatus
Definition
objectstatus.php:9
Bitrix\Calendar\Internals\ObjectStatus\isSuccess
isSuccess()
Definition
objectstatus.php:16
Bitrix\Calendar\Internals\ObjectStatus\getErrors
getErrors()
Definition
objectstatus.php:53
Bitrix\Calendar\Internals\ObjectStatus\getErrorByCode
getErrorByCode(string $code)
Definition
objectstatus.php:78
Bitrix\Calendar\Internals\ObjectStatus\resetErrors
resetErrors()
Definition
objectstatus.php:45
Bitrix\Calendar\Internals\ObjectStatus\addError
addError(string $code, string $message)
Definition
objectstatus.php:34
Bitrix\Calendar\Internals\ObjectStatus\hasErrors
hasErrors()
Definition
objectstatus.php:24
Bitrix\Calendar\Internals\ObjectStatus\getErrorsByCode
getErrorsByCode(string $code)
Definition
objectstatus.php:62
Bitrix\Calendar\Internals
Definition
access.php:3
modules
calendar
lib
internals
objectstatus.php
Создано системой
1.10.0