1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
error.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Translate;
4
5
use Bitrix\Main;
6
10
trait
Error
11
{
13
protected
$errorCollection;
14
22
final
public
function
addError
(
Main
\
Error
$error
): self
23
{
24
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
25
{
26
$this->errorCollection =
new
Main\ErrorCollection
;
27
}
28
29
$this->errorCollection[] =
$error
;
30
31
return
$this;
32
}
33
41
final
public
function
addErrors
(
array
$errors
): self
42
{
43
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
44
{
45
$this->errorCollection =
new
Main\ErrorCollection
;
46
}
47
48
$this->errorCollection->add(
$errors
);
49
50
return
$this;
51
}
52
58
final
public
function
getErrors
():
array
59
{
60
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
61
{
62
return
array
();
63
}
64
65
return
$this->errorCollection->toArray();
66
}
67
75
final
public
function
getErrorByCode
(
$code
): ?
Main
\
Error
76
{
77
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
78
{
79
return
null
;
80
}
81
82
return
$this->errorCollection->getErrorByCode(
$code
);
83
}
84
90
final
public
function
getLastError
(): ?
Main
\
Error
91
{
92
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
93
{
94
return
null
;
95
}
96
if
(!$this->
hasErrors
())
97
{
98
return
null
;
99
}
100
101
$offset = $this->errorCollection->count() - 1;
102
103
return
$this->errorCollection->offsetGet($offset);
104
}
105
111
final
public
function
getFirstError
(): ?
Main
\
Error
112
{
113
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
114
{
115
return
null
;
116
}
117
if
(!$this->
hasErrors
())
118
{
119
return
null
;
120
}
121
122
return
$this->errorCollection->offsetGet(0);
123
}
124
130
final
public
function
hasErrors
(): bool
131
{
132
if
(!$this->errorCollection instanceof
Main
\
ErrorCollection
)
133
{
134
return
false
;
135
}
136
137
return
!$this->errorCollection->isEmpty();
138
}
139
146
final
public
function
hasError
(
$code
): bool
147
{
148
if
(
149
!$this->errorCollection instanceof
Main
\
ErrorCollection
||
150
$this->errorCollection->
isEmpty
()
151
)
152
{
153
return
false
;
154
}
155
156
$err = $this->errorCollection->getErrorByCode(
$code
);
157
158
return
($err instanceof
Main
\
Error
);
159
}
160
}
Bitrix\Main\ErrorCollection
Определения
errorcollection.php:14
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\Type\Dictionary\isEmpty
isEmpty()
Определения
dictionary.php:206
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$errors
$errors
Определения
iblock_catalog_edit.php:74
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Main
Bitrix\Main\getErrors
getErrors()
Определения
errorableimplementation.php:34
Bitrix\Main\hasErrors
hasErrors()
Определения
errorableimplementation.php:17
Bitrix\Main\getErrorByCode
getErrorByCode($code)
Определения
errorableimplementation.php:53
Bitrix\Translate\getLastError
getLastError()
Определения
error.php:90
Bitrix\Translate\getFirstError
getFirstError()
Определения
error.php:111
Bitrix\Translate\addErrors
addErrors(array $errors)
Определения
error.php:41
Bitrix\Translate\addError
addError(Main\Error $error)
Определения
error.php:22
Bitrix\Translate\hasError
hasError($code)
Определения
error.php:146
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
translate
lib
error.php
Создано системой
1.14.0