1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
result.php
См. документацию.
1<?php
2
9
10namespace Bitrix\Main;
11
12use Bitrix\Main\DB\SqlExpression;
13
14class Result
15{
17 protected $isSuccess = true;
18
20
22 protected $data = array();
23
24 public function __construct()
25 {
26 $this->errors = new ErrorCollection();
27 }
28
29 public function __clone()
30 {
31 $this->errors = clone $this->errors;
32 }
33
39 public function isSuccess()
40 {
41 return $this->isSuccess;
42 }
43
50 public function addError(Error $error)
51 {
52 $this->isSuccess = false;
53 $this->errors[] = $error;
54 return $this;
55 }
56
62 public function getError(): ?Error
63 {
64 foreach ($this->errors as $error)
65 {
66 return $error;
67 }
68
69 return null;
70 }
71
77 public function getErrors()
78 {
79 return $this->errors->toArray();
80 }
81
87 public function getErrorCollection()
88 {
89 return $this->errors;
90 }
91
97 public function getErrorMessages()
98 {
99 $messages = array();
100
101 foreach($this->getErrors() as $error)
102 $messages[] = $error->getMessage();
103
104 return $messages;
105 }
106
113 public function addErrors(array $errors)
114 {
115 if ($errors)
116 {
117 $this->isSuccess = false;
118 $this->errors->add($errors);
119 }
120 return $this;
121 }
122
128 public function setData(array $data)
129 {
130 // do not save sql expressions
131 foreach ($data as $k => $v)
132 {
133 if ($v instanceof SqlExpression)
134 {
135 unset($data[$k]);
136 }
137 }
138
139 $this->data = $data;
140
141 return $this;
142 }
143
148 public function getData()
149 {
150 return $this->data;
151 }
152}
Определения error.php:15
getErrors()
Определения result.php:62
addError(Error $error)
Определения result.php:50
__construct()
Определения result.php:24
getError()
Определения result.php:62
addErrors(array $errors)
Определения result.php:113
$isSuccess
Определения result.php:17
ErrorCollection $errors
Определения result.php:19
isSuccess()
Определения result.php:39
getErrors()
Определения result.php:77
$data
Определения result.php:22
getData()
Определения result.php:148
setData(array $data)
Определения result.php:128
getErrorCollection()
Определения result.php:87
__clone()
Определения result.php:29
getErrorMessages()
Определения result.php:97
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$messages
Определения template.php:8
$error
Определения subscription_card_product.php:20
$k
Определения template_pdf.php:567