Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
warning.php
1
<?php
2
3
namespace
Bitrix\Translate
;
4
5
use
Bitrix\Main
;
6
10
trait
Warning
11
{
13
protected
$warningCollection;
14
22
final
public
function
addWarning
(Main\
Error
$error): self
23
{
24
if
(!$this->warningCollection instanceof Main\
ErrorCollection
)
25
{
26
$this->warningCollection =
new
Main\ErrorCollection
;
27
}
28
29
$this->warningCollection[] = $error;
30
31
return
$this;
32
}
33
39
final
public
function
getWarnings
(): array
40
{
41
if
(!$this->warningCollection instanceof Main\
ErrorCollection
)
42
{
43
return
array();
44
}
45
46
return
$this->warningCollection->toArray();
47
}
48
54
final
public
function
hasWarnings
(): bool
55
{
56
if
(!$this->warningCollection instanceof Main\
ErrorCollection
)
57
{
58
return
false
;
59
}
60
61
return
!$this->warningCollection->isEmpty();
62
}
63
69
final
public
function
getLastWarning
(): ?Main\
Error
70
{
71
if
(!$this->warningCollection instanceof Main\
ErrorCollection
)
72
{
73
return
null
;
74
}
75
if
(!$this->
hasWarnings
())
76
{
77
return
null
;
78
}
79
80
$offset = $this->warningCollection->count() - 1;
81
82
return
$this->warningCollection->offsetGet($offset);
83
}
84
90
final
public
function
getFirstWarning
(): ?Main\
Error
91
{
92
if
(!$this->warningCollection instanceof Main\
ErrorCollection
)
93
{
94
return
null
;
95
}
96
if
(!$this->
hasWarnings
())
97
{
98
return
null
;
99
}
100
101
return
$this->warningCollection->offsetGet(0);
102
}
103
}
Bitrix\Main\ErrorCollection
Definition
errorcollection.php:14
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main
Bitrix\Translate
Bitrix\Translate\getFirstWarning
getFirstWarning()
Definition
warning.php:90
Bitrix\Translate\Warning
trait Warning
Definition
warning.php:11
Bitrix\Translate\getLastWarning
getLastWarning()
Definition
warning.php:69
Bitrix\Translate\addWarning
addWarning(Main\Error $error)
Definition
warning.php:22
Bitrix\Translate\getWarnings
getWarnings()
Definition
warning.php:39
Bitrix\Translate\hasWarnings
hasWarnings()
Definition
warning.php:54
modules
translate
lib
warning.php
Создано системой
1.10.0