Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
errorcollection.php
1<?php
9namespace Bitrix\Main;
10
12
14{
19 public function __construct(array $values = null)
20 {
21 if($values)
22 {
23 $this->add($values);
24 }
25 }
26
32 public function add(array $errors)
33 {
34 foreach($errors as $error)
35 {
36 $this->setError($error);
37 }
38 }
39
45 public function getErrorByCode($code)
46 {
47 foreach($this->values as $error)
48 {
50 if($error->getCode() === $code)
51 {
52 return $error;
53 }
54 }
55
56 return null;
57 }
58
65 public function setError(Error $error, $offset = null)
66 {
67 parent::offsetSet($offset, $error);
68 }
69
75 public function offsetSet($offset, $value)
76 {
77 $this->setError($value, $offset);
78 }
79}
setError(Error $error, $offset=null)
__construct(array $values=null)