Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
errorableimplementation.php
1<?
2namespace Bitrix\Main;
3
7trait ErrorableImplementation
8{
10 protected $errorCollection;
11
17 public function hasErrors()
18 {
19 if ($this->errorCollection instanceof ErrorCollection)
20 {
21 return !$this->errorCollection->isEmpty();
22 }
23 else
24 {
25 return false;
26 }
27 }
28
34 public function getErrors()
35 {
36 if ($this->errorCollection instanceof ErrorCollection)
37 {
38 return $this->errorCollection->toArray();
39 }
40 else
41 {
42 return [];
43 }
44 }
45
53 public function getErrorByCode($code)
54 {
55 if ($this->errorCollection instanceof ErrorCollection)
56 {
57 return $this->errorCollection->getErrorByCode($code);
58 }
59 else
60 {
61 return null;
62 }
63 }
64}