1C-Bitrix 25.700.0
warning.php
См. документацию.
1<?php
2
3namespace Bitrix\Translate;
4
5use Bitrix\Main;
6
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}
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
getFirstWarning()
Определения warning.php:90
trait Warning
Определения warning.php:11
getLastWarning()
Определения warning.php:69
addWarning(Main\Error $error)
Определения warning.php:22
getWarnings()
Определения warning.php:39
hasWarnings()
Определения warning.php:54
$error
Определения subscription_card_product.php:20