1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
event.php
См. документацию.
1<?php
2namespace Bitrix\Main;
3
4class Event
5{
6 protected $moduleId;
7 protected $type;
8 protected $parameters = array();
10 protected $parametersLoader = null;
11 protected $filter = null;
12 protected $sender = null;
13
14 protected $debugMode = false;
15 protected $debugInfo = array();
16
18 protected $results = array();
19
21 protected $exceptions = array();
22
29 public function __construct($moduleId, $type, $parameters = array(), $filter = null)
30 {
31 $this->moduleId = $moduleId;
32 $this->type = $type;
34 $this->setFilter($filter);
35
36 $this->debugMode = false;
37 }
38
39 public function getModuleId()
40 {
41 return $this->moduleId;
42 }
43
44 public function getEventType()
45 {
46 return $this->type;
47 }
48
49 public function setParameters($parameters)
50 {
51 if (is_array($parameters))
52 {
53 $this->parameters = $parameters;
54 }
55 elseif ($parameters instanceof \Closure)
56 {
57 $this->parameters = null;
58 $this->parametersLoader = $parameters;
59 }
60 else
61 {
62 throw new ArgumentTypeException("parameter", "array or closure, which returns array");
63 }
64 }
65
66 public function getParameters()
67 {
68 $this->loadParameters();
69
70 return $this->parameters;
71 }
72
73 public function setParameter($key, $value)
74 {
75 $this->loadParameters();
76
77 $this->parameters[$key] = $value;
78 }
79
80 public function getParameter($key)
81 {
82 $this->loadParameters();
83
84 if (isset($this->parameters[$key]))
85 return $this->parameters[$key];
86
87 return null;
88 }
89
90 protected function loadParameters()
91 {
92 if (!$this->parametersLoader)
93 {
94 return false;
95 }
96
97 $this->setParameters(call_user_func_array($this->parametersLoader, array()));
98 $this->parametersLoader = null;
99
100 return true;
101 }
102
103 public function setFilter($filter)
104 {
105 if (!is_array($filter))
106 {
107 if (empty($filter))
108 $filter = null;
109 else
111 }
112
113 $this->filter = $filter;
114 }
115
116 public function getFilter()
117 {
118 return $this->filter;
119 }
120
124 public function getResults()
125 {
126 return $this->results;
127 }
128
130 {
131 $this->results[] = $result;
132 }
133
134 public function getSender()
135 {
136 return $this->sender;
137 }
138
139 public function send($sender = null)
140 {
141 $this->sender = $sender;
142 EventManager::getInstance()->send($this);
143 }
144
145 public function addException(\Exception $exception)
146 {
147 $this->exceptions[] = $exception;
148 }
149
150 public function getExceptions()
151 {
152 return $this->exceptions;
153 }
154
155 public function turnDebugOn()
156 {
157 $this->debugMode = true;
158 }
159
160 public function isDebugOn()
161 {
162 return $this->debugMode;
163 }
164
165 public function addDebugInfo($ar)
166 {
167 if (!$this->debugMode)
168 return;
169
170 $this->debugInfo[] = $ar;
171 }
172
173 public function getDebugInfo()
174 {
175 return $this->debugInfo;
176 }
177}
Определения event.php:5
getParameters()
Определения event.php:66
loadParameters()
Определения event.php:90
setParameters($parameters)
Определения event.php:49
$results
Определения event.php:18
getFilter()
Определения event.php:116
getResults()
Определения event.php:124
$parametersLoader
Определения event.php:10
getSender()
Определения event.php:134
$debugMode
Определения event.php:14
setParameter($key, $value)
Определения event.php:73
$debugInfo
Определения event.php:15
setFilter($filter)
Определения event.php:103
addException(\Exception $exception)
Определения event.php:145
send($sender=null)
Определения event.php:139
turnDebugOn()
Определения event.php:155
getEventType()
Определения event.php:44
$exceptions
Определения event.php:21
__construct($moduleId, $type, $parameters=array(), $filter=null)
Определения event.php:29
$type
Определения event.php:7
addResult(EventResult $result)
Определения event.php:129
$filter
Определения event.php:11
isDebugOn()
Определения event.php:160
$parameters
Определения event.php:8
getDebugInfo()
Определения event.php:173
getModuleId()
Определения event.php:39
$moduleId
Определения event.php:6
getParameter($key)
Определения event.php:80
$sender
Определения event.php:12
getExceptions()
Определения event.php:150
addDebugInfo($ar)
Определения event.php:165
static getInstance()
Определения eventmanager.php:31
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$ar
Определения options.php:199
if(empty($signedUserToken)) $key
Определения quickway.php:257