%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.144.254.72 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 namespace Bitrix\Main; class Event { protected $moduleId; protected $type; protected $parameters = array(); /** @var callable */ protected $parametersLoader = null; protected $filter = null; protected $sender = null; protected $debugMode = false; protected $debugInfo = array(); /** @var EventResult[] */ protected $results = array(); /** @var \Exception[] */ protected $exceptions = array(); /** * @param $moduleId * @param $type * @param array $parameters * @param null|string|string[] $filter Filter of module names, mail event names and component names of the event handlers */ public function __construct($moduleId, $type, $parameters = array(), $filter = null) { $this->moduleId = $moduleId; $this->type = $type; $this->setParameters($parameters); $this->setFilter($filter); $this->debugMode = false; } public function getModuleId() { return $this->moduleId; } public function getEventType() { return $this->type; } public function setParameters($parameters) { if (is_array($parameters)) { $this->parameters = $parameters; } elseif ($parameters instanceof \Closure) { $this->parameters = null; $this->parametersLoader = $parameters; } else { throw new ArgumentTypeException("parameter", "array or closure, which returns array"); } } public function getParameters() { $this->loadParameters(); return $this->parameters; } public function setParameter($key, $value) { $this->loadParameters(); $this->parameters[$key] = $value; } public function getParameter($key) { $this->loadParameters(); if (isset($this->parameters[$key])) return $this->parameters[$key]; return null; } protected function loadParameters() { if (!$this->parametersLoader) { return false; } $this->setParameters(call_user_func_array($this->parametersLoader, array())); $this->parametersLoader = null; return true; } public function setFilter($filter) { if (!is_array($filter)) { if (empty($filter)) $filter = null; else $filter = array($filter); } $this->filter = $filter; } public function getFilter() { return $this->filter; } /** * @return EventResult[] */ public function getResults() { return $this->results; } public function addResult(EventResult $result) { $this->results[] = $result; } public function getSender() { return $this->sender; } public function send($sender = null) { $this->sender = $sender; EventManager::getInstance()->send($this); } public function addException(\Exception $exception) { $this->exceptions[] = $exception; } public function getExceptions() { return $this->exceptions; } public function turnDebugOn() { $this->debugMode = true; } public function isDebugOn() { return $this->debugMode; } public function addDebugInfo($ar) { if (!$this->debugMode) return; $this->debugInfo[] = $ar; } public function getDebugInfo() { return $this->debugInfo; } }