Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lists/lib/internals/error/ |
Upload File : |
<?php namespace Bitrix\Lists\Internals\Error; use Bitrix\Main\Entity\Result; use Bitrix\Main; final class ErrorCollection extends Main\ErrorCollection { /** * Adds one error to collection. * @param Error $error Error object. * @return void */ public function addOne(Error $error) { $this[] = $error; } /** * Adds errors from Main\Entity\Result. * @param Result $result Result after action in Entity. * @return void */ public function addFromResult(Result $result) { $errors = array(); foreach ($result->getErrorMessages() as $message) { $errors[] = new Error($message); } unset($message); $this->add($errors); } /** * Returns true if collection has errors. * @return bool */ public function hasErrors() { return (bool)count($this); } /** * Returns array of errors with the necessary code. * @param string $code Code of error. * @return Error[] */ public function getErrorsByCode($code) { $needle = array(); foreach($this->values as $error) { /** @var Error $error */ if($error->getCode() == $code) { $needle[] = $error; } } unset($error); return $needle; } }