%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.217.37.129 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage main * @copyright 2001-2015 Bitrix */ namespace Bitrix\Main; use Bitrix\Main\DB\SqlExpression; class Result { /** @var bool */ protected $isSuccess = true; /** @var ErrorCollection */ protected $errors; /** @var array */ protected $data = array(); public function __construct() { $this->errors = new ErrorCollection(); } /** * Returns the result status. * * @return bool */ public function isSuccess() { return $this->isSuccess; } /** * Adds the error. * * @param Error $error * @return $this */ public function addError(Error $error) { $this->isSuccess = false; $this->errors[] = $error; return $this; } /** * Returns an array of Error objects. * * @return Error[] */ public function getErrors() { return $this->errors->toArray(); } /** * Returns the error collection. * * @return ErrorCollection */ public function getErrorCollection() { return $this->errors; } /** * Returns array of strings with error messages * * @return array */ public function getErrorMessages() { $messages = array(); foreach($this->getErrors() as $error) $messages[] = $error->getMessage(); return $messages; } /** * Adds array of Error objects * * @param Error[] $errors * @return $this */ public function addErrors(array $errors) { $this->isSuccess = false; $this->errors->add($errors); return $this; } /** * Sets data of the result. * @param array $data * @return $this */ public function setData(array $data) { // do not save sql expressions foreach ($data as $k => $v) { if ($v instanceof SqlExpression) { unset($data[$k]); } } $this->data = $data; return $this; } /** * Returns data array saved into the result. * @return array */ public function getData() { return $this->data; } }