@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * Парсер значений |
47 | 47 | */ |
48 | - public function parse (array &$args); |
|
48 | + public function parse(array &$args); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param string $name - имя флага |
64 | 64 | */ |
65 | - public function __construct (string $name) |
|
65 | + public function __construct(string $name) |
|
66 | 66 | { |
67 | 67 | $this->names = [$name]; |
68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return Flag - возвращает сам себя |
76 | 76 | */ |
77 | - public function setLocale (Locale $locale): Param |
|
77 | + public function setLocale(Locale $locale): Param |
|
78 | 78 | { |
79 | 79 | $this->locale = $locale; |
80 | 80 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return Flag - возвращает сам себя |
90 | 90 | */ |
91 | - public function addAliase (string $name) |
|
91 | + public function addAliase(string $name) |
|
92 | 92 | { |
93 | - if (array_search ($name, $this->names) !== false) |
|
94 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
93 | + if (array_search($name, $this->names) !== false) |
|
94 | + throw new \Exception($this->locale->aliase_exists_exception); |
|
95 | 95 | |
96 | 96 | $this->names[] = $name; |
97 | 97 | |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | * |
106 | 106 | * Возвращает состояние флага |
107 | 107 | */ |
108 | - public function parse (array &$args) |
|
108 | + public function parse(array &$args) |
|
109 | 109 | { |
110 | - $args = array_values ($args); |
|
110 | + $args = array_values($args); |
|
111 | 111 | |
112 | 112 | foreach ($this->names as $name) |
113 | - if (($key = array_search ($name, $args)) !== false) |
|
113 | + if (($key = array_search($name, $args)) !== false) |
|
114 | 114 | { |
115 | 115 | unset ($args[$key]); |
116 | - $args = array_values ($args); |
|
116 | + $args = array_values($args); |
|
117 | 117 | |
118 | - while ($this->parse ($args) !== false); |
|
118 | + while ($this->parse($args) !== false); |
|
119 | 119 | |
120 | 120 | return true; |
121 | 121 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * [@param string $defaultValue = null] - значение параметра по умолчанию |
143 | 143 | * [@param bool $required = false] - обязательно ли указание параметра |
144 | 144 | */ |
145 | - public function __construct (string $name, string $defaultValue = null, bool $required = false) |
|
145 | + public function __construct(string $name, string $defaultValue = null, bool $required = false) |
|
146 | 146 | { |
147 | 147 | $this->names = [$name]; |
148 | 148 | $this->defaultValue = $defaultValue; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return Param - возвращает сам себя |
160 | 160 | */ |
161 | - public function setLocale (Locale $locale): Param |
|
161 | + public function setLocale(Locale $locale): Param |
|
162 | 162 | { |
163 | 163 | $this->locale = $locale; |
164 | 164 | |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return Param - возвращает сам себя |
174 | 174 | */ |
175 | - public function addAliase (string $name) |
|
175 | + public function addAliase(string $name) |
|
176 | 176 | { |
177 | - if (array_search ($name, $this->names) !== false) |
|
178 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
177 | + if (array_search($name, $this->names) !== false) |
|
178 | + throw new \Exception($this->locale->aliase_exists_exception); |
|
179 | 179 | |
180 | 180 | $this->names[] = $name; |
181 | 181 | |
@@ -189,27 +189,27 @@ discard block |
||
189 | 189 | * |
190 | 190 | * Возвращает найденый параметр или массив найдёных параметров, если их было указано несколько |
191 | 191 | */ |
192 | - public function parse (array &$args) |
|
192 | + public function parse(array &$args) |
|
193 | 193 | { |
194 | - $args = array_values ($args); |
|
194 | + $args = array_values($args); |
|
195 | 195 | |
196 | 196 | foreach ($this->names as $name) |
197 | - if (($key = array_search ($name, $args)) !== false) |
|
197 | + if (($key = array_search($name, $args)) !== false) |
|
198 | 198 | { |
199 | 199 | if (!isset ($args[$key + 1])) |
200 | - throw new \Exception ($this->locale->unselected_value_exception); |
|
200 | + throw new \Exception($this->locale->unselected_value_exception); |
|
201 | 201 | |
202 | 202 | $param = [$args[$key + 1]]; |
203 | 203 | |
204 | 204 | unset ($args[$key], $args[$key + 1]); |
205 | - $args = array_values ($args); |
|
205 | + $args = array_values($args); |
|
206 | 206 | |
207 | 207 | try |
208 | 208 | { |
209 | - while (($altParam = $this->parse ($args)) !== $this->defaultValue) |
|
209 | + while (($altParam = $this->parse($args)) !== $this->defaultValue) |
|
210 | 210 | { |
211 | - if (is_array ($altParam)) |
|
212 | - $param = array_merge ($param, $altParam); |
|
211 | + if (is_array($altParam)) |
|
212 | + $param = array_merge($param, $altParam); |
|
213 | 213 | |
214 | 214 | else $param[] = $altParam; |
215 | 215 | } |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | |
218 | 218 | catch (\Throwable $e) {} |
219 | 219 | |
220 | - return sizeof ($param) == 1 ? |
|
220 | + return sizeof($param) == 1 ? |
|
221 | 221 | $param[0] : $param; |
222 | 222 | } |
223 | 223 | |
224 | 224 | if ($this->required) |
225 | - throw new \Exception ($this->locale->undefined_param_exception); |
|
225 | + throw new \Exception($this->locale->undefined_param_exception); |
|
226 | 226 | |
227 | 227 | return $this->defaultValue; |
228 | 228 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * [@param string $defaultValue = null] - значение сеттера по умолчанию |
249 | 249 | * [@param bool $required = false] - обязательно ли указание сеттера |
250 | 250 | */ |
251 | - public function __construct (string $name, string $separator = '=', string $defaultValue = null, bool $required = false) |
|
251 | + public function __construct(string $name, string $separator = '=', string $defaultValue = null, bool $required = false) |
|
252 | 252 | { |
253 | 253 | $this->names = [$name]; |
254 | 254 | $this->separator = $separator; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return Param - возвращает сам себя |
267 | 267 | */ |
268 | - public function setLocale (Locale $locale): Param |
|
268 | + public function setLocale(Locale $locale): Param |
|
269 | 269 | { |
270 | 270 | $this->locale = $locale; |
271 | 271 | |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return Param - возвращает сам себя |
281 | 281 | */ |
282 | - public function addAliase (string $name) |
|
282 | + public function addAliase(string $name) |
|
283 | 283 | { |
284 | - if (array_search ($name, $this->names) !== false) |
|
285 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
284 | + if (array_search($name, $this->names) !== false) |
|
285 | + throw new \Exception($this->locale->aliase_exists_exception); |
|
286 | 286 | |
287 | 287 | $this->names[] = $name; |
288 | 288 | |
@@ -296,26 +296,26 @@ discard block |
||
296 | 296 | * |
297 | 297 | * Возвращает найденый параметр или массив найдёных параметров, если их было указано несколько |
298 | 298 | */ |
299 | - public function parse (array &$args) |
|
299 | + public function parse(array &$args) |
|
300 | 300 | { |
301 | - $args = array_values ($args); |
|
302 | - $l = strlen ($this->separator); |
|
301 | + $args = array_values($args); |
|
302 | + $l = strlen($this->separator); |
|
303 | 303 | |
304 | 304 | foreach ($this->names as $name) |
305 | 305 | foreach ($args as $id => $arg) |
306 | - if (substr ($arg, 0, ($pos = strlen ($name) + $l)) == $name . $this->separator) |
|
306 | + if (substr($arg, 0, ($pos = strlen($name) + $l)) == $name.$this->separator) |
|
307 | 307 | { |
308 | - $param = [substr ($arg, $pos)]; |
|
308 | + $param = [substr($arg, $pos)]; |
|
309 | 309 | |
310 | 310 | unset ($args[$id]); |
311 | - $args = array_values ($args); |
|
311 | + $args = array_values($args); |
|
312 | 312 | |
313 | 313 | try |
314 | 314 | { |
315 | - while (($altParam = $this->parse ($args)) !== $this->defaultValue) |
|
315 | + while (($altParam = $this->parse($args)) !== $this->defaultValue) |
|
316 | 316 | { |
317 | - if (is_array ($altParam)) |
|
318 | - $param = array_merge ($param, $altParam); |
|
317 | + if (is_array($altParam)) |
|
318 | + $param = array_merge($param, $altParam); |
|
319 | 319 | |
320 | 320 | else $param[] = $altParam; |
321 | 321 | } |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | |
324 | 324 | catch (\Throwable $e) {} |
325 | 325 | |
326 | - return sizeof ($param) == 1 ? |
|
326 | + return sizeof($param) == 1 ? |
|
327 | 327 | $param[0] : $param; |
328 | 328 | } |
329 | 329 | |
330 | 330 | if ($this->required) |
331 | - throw new \Exception ($this->locale->undefined_param_exception); |
|
331 | + throw new \Exception($this->locale->undefined_param_exception); |
|
332 | 332 | |
333 | 333 | return $this->defaultValue; |
334 | 334 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @param string $name - имя команды |
353 | 353 | * [@param \Closure $callable = null] - анонимная функция для выполнения |
354 | 354 | */ |
355 | - public function __construct (string $name, \Closure $callable = null) |
|
355 | + public function __construct(string $name, \Closure $callable = null) |
|
356 | 356 | { |
357 | 357 | $this->name = $name; |
358 | 358 | $this->locale = new Locale; |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return Command - возвращает сам себя |
370 | 370 | */ |
371 | - public function setLocale (Locale $locale): Command |
|
371 | + public function setLocale(Locale $locale): Command |
|
372 | 372 | { |
373 | 373 | $this->locale = $locale; |
374 | 374 | |
@@ -382,13 +382,13 @@ discard block |
||
382 | 382 | * |
383 | 383 | * @return Command - возвращает сам себя |
384 | 384 | */ |
385 | - public function addParams (array $params): Command |
|
385 | + public function addParams(array $params): Command |
|
386 | 386 | { |
387 | 387 | foreach ($params as $param) |
388 | 388 | if ($param instanceof Parameter) |
389 | - $this->params[current ($param->names)] = $param; |
|
389 | + $this->params[current($param->names)] = $param; |
|
390 | 390 | |
391 | - else throw new \Exception ($this->locale->param_type_exception); |
|
391 | + else throw new \Exception($this->locale->param_type_exception); |
|
392 | 392 | |
393 | 393 | return $this; |
394 | 394 | } |
@@ -400,12 +400,12 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return array - возвращает ассоциативный массив [параметр] => [значение] |
402 | 402 | */ |
403 | - public function getParams (array &$args): array |
|
403 | + public function getParams(array &$args): array |
|
404 | 404 | { |
405 | - $params = array_combine (array_keys ($this->params), array_fill (0, sizeof ($this->params), null)); |
|
405 | + $params = array_combine(array_keys($this->params), array_fill(0, sizeof($this->params), null)); |
|
406 | 406 | |
407 | 407 | foreach ($this->params as $name => $param) |
408 | - $params[$name] = $param->parse ($args); |
|
408 | + $params[$name] = $param->parse($args); |
|
409 | 409 | |
410 | 410 | return $params; |
411 | 411 | } |
@@ -415,16 +415,16 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @param array &$args - аргументы команды |
417 | 417 | */ |
418 | - public function execute (array &$args) |
|
418 | + public function execute(array &$args) |
|
419 | 419 | { |
420 | 420 | if ($this->callable instanceof \Closure) |
421 | 421 | { |
422 | - $params = $this->getParams ($args); |
|
422 | + $params = $this->getParams($args); |
|
423 | 423 | |
424 | - return $this->callable->call ($this, array_values ($args), $params); |
|
424 | + return $this->callable->call($this, array_values($args), $params); |
|
425 | 425 | } |
426 | 426 | |
427 | - throw new \Exception ($this->locale->execution_error); |
|
427 | + throw new \Exception($this->locale->execution_error); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * |
440 | 440 | * [@param \Closure $callable = null] - анонимная функция для выполнения |
441 | 441 | */ |
442 | - public function __construct (\Closure $callable = null) |
|
442 | + public function __construct(\Closure $callable = null) |
|
443 | 443 | { |
444 | 444 | if ($callable !== null) |
445 | 445 | $this->callable = $callable; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * @param array $commands - список команд |
463 | 463 | * [@param DefaultCommand $defaultCommand = null] - объект дефолтной команды |
464 | 464 | */ |
465 | - public function __construct (array $commands, DefaultCommand $defaultCommand = null) |
|
465 | + public function __construct(array $commands, DefaultCommand $defaultCommand = null) |
|
466 | 466 | { |
467 | 467 | $this->locale = new Locale; |
468 | 468 | $this->defaultCommand = $defaultCommand; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | if ($command instanceof Command) |
472 | 472 | $this->commands[$command->name] = $command; |
473 | 473 | |
474 | - else throw new \Exception ($this->locale->command_type_exception); |
|
474 | + else throw new \Exception($this->locale->command_type_exception); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return Manager - возвращает сам себя |
483 | 483 | */ |
484 | - public function setLocale (Locale $locale): Manager |
|
484 | + public function setLocale(Locale $locale): Manager |
|
485 | 485 | { |
486 | 486 | $this->locale = $locale; |
487 | 487 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return Manager - возвращает сам себя |
497 | 497 | */ |
498 | - public function setDefault (DefaultCommand $defaultCommand): Manager |
|
498 | + public function setDefault(DefaultCommand $defaultCommand): Manager |
|
499 | 499 | { |
500 | 500 | $this->defaultCommand = $defaultCommand; |
501 | 501 | |
@@ -507,25 +507,25 @@ discard block |
||
507 | 507 | * |
508 | 508 | * @param array $args - список аргументов консоли |
509 | 509 | */ |
510 | - public function execute (array $args) |
|
510 | + public function execute(array $args) |
|
511 | 511 | { |
512 | - $args = array_values ($args); |
|
512 | + $args = array_values($args); |
|
513 | 513 | |
514 | 514 | if (!isset ($args[0])) |
515 | 515 | { |
516 | 516 | if ($this->defaultCommand !== null) |
517 | - return $this->defaultCommand->execute ($args); |
|
517 | + return $this->defaultCommand->execute($args); |
|
518 | 518 | |
519 | - else throw new \Exception ($this->locale->command_undefined_error); |
|
519 | + else throw new \Exception($this->locale->command_undefined_error); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | $name = $args[0]; |
523 | - $args = array_slice ($args, 1); |
|
523 | + $args = array_slice($args, 1); |
|
524 | 524 | |
525 | 525 | if (!isset ($this->commands[$name])) |
526 | 526 | return $this->defaultCommand !== null ? |
527 | - $this->defaultCommand->execute ($args) : false; |
|
527 | + $this->defaultCommand->execute($args) : false; |
|
528 | 528 | |
529 | - return $this->commands[$name]->execute ($args); |
|
529 | + return $this->commands[$name]->execute($args); |
|
530 | 530 | } |
531 | 531 | } |
@@ -90,8 +90,9 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function addAliase (string $name) |
92 | 92 | { |
93 | - if (array_search ($name, $this->names) !== false) |
|
94 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
93 | + if (array_search ($name, $this->names) !== false) { |
|
94 | + throw new \Exception ($this->locale->aliase_exists_exception); |
|
95 | + } |
|
95 | 96 | |
96 | 97 | $this->names[] = $name; |
97 | 98 | |
@@ -109,10 +110,11 @@ discard block |
||
109 | 110 | { |
110 | 111 | $args = array_values ($args); |
111 | 112 | |
112 | - foreach ($this->names as $name) |
|
113 | - if (($key = array_search ($name, $args)) !== false) |
|
113 | + foreach ($this->names as $name) { |
|
114 | + if (($key = array_search ($name, $args)) !== false) |
|
114 | 115 | { |
115 | 116 | unset ($args[$key]); |
117 | + } |
|
116 | 118 | $args = array_values ($args); |
117 | 119 | |
118 | 120 | while ($this->parse ($args) !== false); |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | */ |
175 | 177 | public function addAliase (string $name) |
176 | 178 | { |
177 | - if (array_search ($name, $this->names) !== false) |
|
178 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
179 | + if (array_search ($name, $this->names) !== false) { |
|
180 | + throw new \Exception ($this->locale->aliase_exists_exception); |
|
181 | + } |
|
179 | 182 | |
180 | 183 | $this->names[] = $name; |
181 | 184 | |
@@ -193,11 +196,12 @@ discard block |
||
193 | 196 | { |
194 | 197 | $args = array_values ($args); |
195 | 198 | |
196 | - foreach ($this->names as $name) |
|
197 | - if (($key = array_search ($name, $args)) !== false) |
|
199 | + foreach ($this->names as $name) { |
|
200 | + if (($key = array_search ($name, $args)) !== false) |
|
198 | 201 | { |
199 | 202 | if (!isset ($args[$key + 1])) |
200 | 203 | throw new \Exception ($this->locale->unselected_value_exception); |
204 | + } |
|
201 | 205 | |
202 | 206 | $param = [$args[$key + 1]]; |
203 | 207 | |
@@ -208,21 +212,21 @@ discard block |
||
208 | 212 | { |
209 | 213 | while (($altParam = $this->parse ($args)) !== $this->defaultValue) |
210 | 214 | { |
211 | - if (is_array ($altParam)) |
|
212 | - $param = array_merge ($param, $altParam); |
|
213 | - |
|
214 | - else $param[] = $altParam; |
|
215 | + if (is_array ($altParam)) { |
|
216 | + $param = array_merge ($param, $altParam); |
|
217 | + } else { |
|
218 | + $param[] = $altParam; |
|
219 | + } |
|
215 | 220 | } |
216 | - } |
|
217 | - |
|
218 | - catch (\Throwable $e) {} |
|
221 | + } catch (\Throwable $e) {} |
|
219 | 222 | |
220 | 223 | return sizeof ($param) == 1 ? |
221 | 224 | $param[0] : $param; |
222 | 225 | } |
223 | 226 | |
224 | - if ($this->required) |
|
225 | - throw new \Exception ($this->locale->undefined_param_exception); |
|
227 | + if ($this->required) { |
|
228 | + throw new \Exception ($this->locale->undefined_param_exception); |
|
229 | + } |
|
226 | 230 | |
227 | 231 | return $this->defaultValue; |
228 | 232 | } |
@@ -281,8 +285,9 @@ discard block |
||
281 | 285 | */ |
282 | 286 | public function addAliase (string $name) |
283 | 287 | { |
284 | - if (array_search ($name, $this->names) !== false) |
|
285 | - throw new \Exception ($this->locale->aliase_exists_exception); |
|
288 | + if (array_search ($name, $this->names) !== false) { |
|
289 | + throw new \Exception ($this->locale->aliase_exists_exception); |
|
290 | + } |
|
286 | 291 | |
287 | 292 | $this->names[] = $name; |
288 | 293 | |
@@ -301,11 +306,12 @@ discard block |
||
301 | 306 | $args = array_values ($args); |
302 | 307 | $l = strlen ($this->separator); |
303 | 308 | |
304 | - foreach ($this->names as $name) |
|
305 | - foreach ($args as $id => $arg) |
|
309 | + foreach ($this->names as $name) { |
|
310 | + foreach ($args as $id => $arg) |
|
306 | 311 | if (substr ($arg, 0, ($pos = strlen ($name) + $l)) == $name . $this->separator) |
307 | 312 | { |
308 | 313 | $param = [substr ($arg, $pos)]; |
314 | + } |
|
309 | 315 | |
310 | 316 | unset ($args[$id]); |
311 | 317 | $args = array_values ($args); |
@@ -314,21 +320,21 @@ discard block |
||
314 | 320 | { |
315 | 321 | while (($altParam = $this->parse ($args)) !== $this->defaultValue) |
316 | 322 | { |
317 | - if (is_array ($altParam)) |
|
318 | - $param = array_merge ($param, $altParam); |
|
319 | - |
|
320 | - else $param[] = $altParam; |
|
323 | + if (is_array ($altParam)) { |
|
324 | + $param = array_merge ($param, $altParam); |
|
325 | + } else { |
|
326 | + $param[] = $altParam; |
|
327 | + } |
|
321 | 328 | } |
322 | - } |
|
323 | - |
|
324 | - catch (\Throwable $e) {} |
|
329 | + } catch (\Throwable $e) {} |
|
325 | 330 | |
326 | 331 | return sizeof ($param) == 1 ? |
327 | 332 | $param[0] : $param; |
328 | 333 | } |
329 | 334 | |
330 | - if ($this->required) |
|
331 | - throw new \Exception ($this->locale->undefined_param_exception); |
|
335 | + if ($this->required) { |
|
336 | + throw new \Exception ($this->locale->undefined_param_exception); |
|
337 | + } |
|
332 | 338 | |
333 | 339 | return $this->defaultValue; |
334 | 340 | } |
@@ -357,8 +363,9 @@ discard block |
||
357 | 363 | $this->name = $name; |
358 | 364 | $this->locale = new Locale; |
359 | 365 | |
360 | - if ($callable !== null) |
|
361 | - $this->callable = $callable; |
|
366 | + if ($callable !== null) { |
|
367 | + $this->callable = $callable; |
|
368 | + } |
|
362 | 369 | } |
363 | 370 | |
364 | 371 | /** |
@@ -384,11 +391,14 @@ discard block |
||
384 | 391 | */ |
385 | 392 | public function addParams (array $params): Command |
386 | 393 | { |
387 | - foreach ($params as $param) |
|
388 | - if ($param instanceof Parameter) |
|
394 | + foreach ($params as $param) { |
|
395 | + if ($param instanceof Parameter) |
|
389 | 396 | $this->params[current ($param->names)] = $param; |
397 | + } |
|
390 | 398 | |
391 | - else throw new \Exception ($this->locale->param_type_exception); |
|
399 | + else { |
|
400 | + throw new \Exception ($this->locale->param_type_exception); |
|
401 | + } |
|
392 | 402 | |
393 | 403 | return $this; |
394 | 404 | } |
@@ -404,8 +414,9 @@ discard block |
||
404 | 414 | { |
405 | 415 | $params = array_combine (array_keys ($this->params), array_fill (0, sizeof ($this->params), null)); |
406 | 416 | |
407 | - foreach ($this->params as $name => $param) |
|
408 | - $params[$name] = $param->parse ($args); |
|
417 | + foreach ($this->params as $name => $param) { |
|
418 | + $params[$name] = $param->parse ($args); |
|
419 | + } |
|
409 | 420 | |
410 | 421 | return $params; |
411 | 422 | } |
@@ -441,8 +452,9 @@ discard block |
||
441 | 452 | */ |
442 | 453 | public function __construct (\Closure $callable = null) |
443 | 454 | { |
444 | - if ($callable !== null) |
|
445 | - $this->callable = $callable; |
|
455 | + if ($callable !== null) { |
|
456 | + $this->callable = $callable; |
|
457 | + } |
|
446 | 458 | } |
447 | 459 | } |
448 | 460 | |
@@ -467,11 +479,14 @@ discard block |
||
467 | 479 | $this->locale = new Locale; |
468 | 480 | $this->defaultCommand = $defaultCommand; |
469 | 481 | |
470 | - foreach ($commands as $command) |
|
471 | - if ($command instanceof Command) |
|
482 | + foreach ($commands as $command) { |
|
483 | + if ($command instanceof Command) |
|
472 | 484 | $this->commands[$command->name] = $command; |
485 | + } |
|
473 | 486 | |
474 | - else throw new \Exception ($this->locale->command_type_exception); |
|
487 | + else { |
|
488 | + throw new \Exception ($this->locale->command_type_exception); |
|
489 | + } |
|
475 | 490 | } |
476 | 491 | |
477 | 492 | /** |
@@ -513,18 +528,20 @@ discard block |
||
513 | 528 | |
514 | 529 | if (!isset ($args[0])) |
515 | 530 | { |
516 | - if ($this->defaultCommand !== null) |
|
517 | - return $this->defaultCommand->execute ($args); |
|
518 | - |
|
519 | - else throw new \Exception ($this->locale->command_undefined_error); |
|
531 | + if ($this->defaultCommand !== null) { |
|
532 | + return $this->defaultCommand->execute ($args); |
|
533 | + } else { |
|
534 | + throw new \Exception ($this->locale->command_undefined_error); |
|
535 | + } |
|
520 | 536 | } |
521 | 537 | |
522 | 538 | $name = $args[0]; |
523 | 539 | $args = array_slice ($args, 1); |
524 | 540 | |
525 | - if (!isset ($this->commands[$name])) |
|
526 | - return $this->defaultCommand !== null ? |
|
541 | + if (!isset ($this->commands[$name])) { |
|
542 | + return $this->defaultCommand !== null ? |
|
527 | 543 | $this->defaultCommand->execute ($args) : false; |
544 | + } |
|
528 | 545 | |
529 | 546 | return $this->commands[$name]->execute ($args); |
530 | 547 | } |
@@ -8,18 +8,18 @@ |
||
8 | 8 | chdir (CORE_DIR); |
9 | 9 | |
10 | 10 | foreach (glob ('ext/php_*.dll') as $ext) |
11 | - if (!extension_loaded (substr (basename ($ext), 4, -4))) |
|
12 | - load_extension ($ext); |
|
11 | + if (!extension_loaded (substr (basename ($ext), 4, -4))) |
|
12 | + load_extension ($ext); |
|
13 | 13 | |
14 | 14 | if (file_exists ('../engine/VoidEngine.php')) |
15 | - require '../engine/VoidEngine.php'; |
|
15 | + require '../engine/VoidEngine.php'; |
|
16 | 16 | |
17 | 17 | elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) |
18 | - require FRAMEWORK_DIR .'/engine/VoidEngine.php'; |
|
18 | + require FRAMEWORK_DIR .'/engine/VoidEngine.php'; |
|
19 | 19 | |
20 | 20 | else message ('VoidEngine not founded'); |
21 | 21 | |
22 | 22 | $app = '../../app/start.php'; |
23 | 23 | |
24 | 24 | if (file_exists ($app)) |
25 | - require $app; |
|
25 | + require $app; |
@@ -2,24 +2,24 @@ |
||
2 | 2 | |
3 | 3 | namespace VoidEngine; |
4 | 4 | |
5 | -define ('VoidEngine\FRAMEWORK_DIR', getenv ('AppData') .'\VoidFramework'); |
|
5 | +define('VoidEngine\FRAMEWORK_DIR', getenv('AppData').'\VoidFramework'); |
|
6 | 6 | |
7 | 7 | const CORE_DIR = __DIR__; |
8 | -chdir (CORE_DIR); |
|
8 | +chdir(CORE_DIR); |
|
9 | 9 | |
10 | -foreach (glob ('ext/php_*.dll') as $ext) |
|
11 | - if (!extension_loaded (substr (basename ($ext), 4, -4))) |
|
12 | - load_extension ($ext); |
|
10 | +foreach (glob('ext/php_*.dll') as $ext) |
|
11 | + if (!extension_loaded(substr(basename($ext), 4, -4))) |
|
12 | + load_extension($ext); |
|
13 | 13 | |
14 | -if (file_exists ('../engine/VoidEngine.php')) |
|
14 | +if (file_exists('../engine/VoidEngine.php')) |
|
15 | 15 | require '../engine/VoidEngine.php'; |
16 | 16 | |
17 | -elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) |
|
18 | - require FRAMEWORK_DIR .'/engine/VoidEngine.php'; |
|
17 | +elseif (file_exists(FRAMEWORK_DIR.'/engine/VoidEngine.php')) |
|
18 | + require FRAMEWORK_DIR.'/engine/VoidEngine.php'; |
|
19 | 19 | |
20 | -else message ('VoidEngine not founded'); |
|
20 | +else message('VoidEngine not founded'); |
|
21 | 21 | |
22 | 22 | $app = '../../app/start.php'; |
23 | 23 | |
24 | -if (file_exists ($app)) |
|
24 | +if (file_exists($app)) |
|
25 | 25 | require $app; |
@@ -7,19 +7,21 @@ |
||
7 | 7 | const CORE_DIR = __DIR__; |
8 | 8 | chdir (CORE_DIR); |
9 | 9 | |
10 | -foreach (glob ('ext/php_*.dll') as $ext) |
|
10 | +foreach (glob ('ext/php_*.dll') as $ext) { |
|
11 | 11 | if (!extension_loaded (substr (basename ($ext), 4, -4))) |
12 | 12 | load_extension ($ext); |
13 | +} |
|
13 | 14 | |
14 | -if (file_exists ('../engine/VoidEngine.php')) |
|
15 | +if (file_exists ('../engine/VoidEngine.php')) { |
|
15 | 16 | require '../engine/VoidEngine.php'; |
16 | - |
|
17 | -elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) |
|
17 | +} elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) { |
|
18 | 18 | require FRAMEWORK_DIR .'/engine/VoidEngine.php'; |
19 | - |
|
20 | -else message ('VoidEngine not founded'); |
|
19 | +} else { |
|
20 | + message ('VoidEngine not founded'); |
|
21 | +} |
|
21 | 22 | |
22 | 23 | $app = '../../app/start.php'; |
23 | 24 | |
24 | -if (file_exists ($app)) |
|
25 | +if (file_exists ($app)) { |
|
25 | 26 | require $app; |
27 | +} |
@@ -8,338 +8,338 @@ |
||
8 | 8 | $converter = new WFClass ('System.Drawing.ColorTranslator'); |
9 | 9 | |
10 | 10 | $constants = [ |
11 | - # Информация об окружении |
|
11 | + # Информация об окружении |
|
12 | 12 | |
13 | - 'EXE_NAME' => $APPLICATION->executablePath, |
|
14 | - 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | - 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
16 | - 'START_PARAMS' => $params, |
|
17 | - 'USERNAME' => $env->username, |
|
13 | + 'EXE_NAME' => $APPLICATION->executablePath, |
|
14 | + 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | + 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
16 | + 'START_PARAMS' => $params, |
|
17 | + 'USERNAME' => $env->username, |
|
18 | 18 | |
19 | - # Константы MessageBox'а |
|
19 | + # Константы MessageBox'а |
|
20 | 20 | |
21 | - 'MB_YESNO' => 4, |
|
22 | - 'MB_YESNOCANCEL' => 3, |
|
23 | - 'MB_OK' => 0, |
|
24 | - 'MB_OKCANCEL' => 1, |
|
25 | - 'MB_RETRYCANCEL' => 5, |
|
26 | - 'MB_ABORTRETRYIGNORE' => 2, |
|
27 | - 'MBI_ASTERISK' => 64, |
|
28 | - 'MBI_ERROR' => 16, |
|
29 | - 'MBI_EXCLAMATION' => 48, |
|
30 | - 'MBI_HAND' => 16, |
|
31 | - 'MBI_INFORMATION' => 64, |
|
32 | - 'MBI_NONE' => 0, |
|
33 | - 'MBI_QUESTION' => 32, |
|
34 | - 'MBI_STOP' => 16, |
|
35 | - 'MBI_WARNING' => 48, |
|
36 | - 'MBDB_1' => 0, |
|
37 | - 'MBDB_2' => 256, |
|
38 | - 'MBDB_3' => 512, |
|
21 | + 'MB_YESNO' => 4, |
|
22 | + 'MB_YESNOCANCEL' => 3, |
|
23 | + 'MB_OK' => 0, |
|
24 | + 'MB_OKCANCEL' => 1, |
|
25 | + 'MB_RETRYCANCEL' => 5, |
|
26 | + 'MB_ABORTRETRYIGNORE' => 2, |
|
27 | + 'MBI_ASTERISK' => 64, |
|
28 | + 'MBI_ERROR' => 16, |
|
29 | + 'MBI_EXCLAMATION' => 48, |
|
30 | + 'MBI_HAND' => 16, |
|
31 | + 'MBI_INFORMATION' => 64, |
|
32 | + 'MBI_NONE' => 0, |
|
33 | + 'MBI_QUESTION' => 32, |
|
34 | + 'MBI_STOP' => 16, |
|
35 | + 'MBI_WARNING' => 48, |
|
36 | + 'MBDB_1' => 0, |
|
37 | + 'MBDB_2' => 256, |
|
38 | + 'MBDB_3' => 512, |
|
39 | 39 | |
40 | - # Константы DialogResult |
|
40 | + # Константы DialogResult |
|
41 | 41 | |
42 | - 'drOk' => 1, |
|
43 | - 'drYes' => 6, |
|
44 | - 'drNo' => 7, |
|
45 | - 'drCancel' => 2, |
|
46 | - 'drRetry' => 4, |
|
47 | - 'drAbort' => 3, |
|
48 | - 'drIgnore' => 5, |
|
49 | - 'drNone' => 0, |
|
42 | + 'drOk' => 1, |
|
43 | + 'drYes' => 6, |
|
44 | + 'drNo' => 7, |
|
45 | + 'drCancel' => 2, |
|
46 | + 'drRetry' => 4, |
|
47 | + 'drAbort' => 3, |
|
48 | + 'drIgnore' => 5, |
|
49 | + 'drNone' => 0, |
|
50 | 50 | |
51 | - # Константы форм |
|
51 | + # Константы форм |
|
52 | 52 | |
53 | - 'fbsNone' => 0, |
|
54 | - 'fbsSingle' => 1, |
|
55 | - 'fbs3D' => 2, |
|
56 | - 'fbsDialog' => 3, |
|
57 | - 'fbsSizable' => 4, |
|
58 | - 'fbsToolWindow' => 5, |
|
59 | - 'fbsSizableToolWindow' => 6, |
|
60 | - |
|
61 | - 'fwsNormal' => 0, |
|
62 | - 'fwsMinimized' => 1, |
|
63 | - 'fwsMaximized' => 2, |
|
64 | - |
|
65 | - 'fspManual' => 0, |
|
66 | - 'fspCenterScreen' => 1, |
|
67 | - 'fspWindowsDefaultLocation' => 2, |
|
68 | - 'fspWindowsDefaultBounds' => 3, |
|
69 | - 'fspCenterParent' => 4, |
|
70 | - |
|
71 | - # Константы стиля оконтовки |
|
72 | - |
|
73 | - 'bsNone' => 0, |
|
74 | - 'bsFixedSingle' => 1, |
|
75 | - 'bsFixed3D' => 2, |
|
76 | - |
|
77 | - # Константы выравнивания |
|
78 | - |
|
79 | - 'alTopLeft' => 1, |
|
80 | - 'alTopCenter' => 2, |
|
81 | - 'alTopRight' => 4, |
|
82 | - 'alMiddleLeft' => 16, |
|
83 | - 'alMiddleCenter' => 32, |
|
84 | - 'alMiddleRight' => 64, |
|
85 | - 'alBottomLeft' => 256, |
|
86 | - 'alBottomCenter' => 512, |
|
87 | - 'alBottomRight' => 1024, |
|
88 | - |
|
89 | - # Константы притягивания (Anchor) |
|
90 | - |
|
91 | - 'acNone' => 0, |
|
92 | - 'acTop' => 1, |
|
93 | - 'acBottom' => 2, |
|
94 | - 'acLeft' => 4, |
|
95 | - 'acRight' => 8, |
|
96 | - |
|
97 | - # Константы SizeMode-параметра PictureBox'а |
|
98 | - |
|
99 | - 'smNormal' => 0, |
|
100 | - 'smStretchImage' => 1, |
|
101 | - 'smAutoSize' => 2, |
|
102 | - 'smCenterImage' => 3, |
|
103 | - 'smZoom' => 4, |
|
104 | - |
|
105 | - # Константы View-параметра ListView'а |
|
53 | + 'fbsNone' => 0, |
|
54 | + 'fbsSingle' => 1, |
|
55 | + 'fbs3D' => 2, |
|
56 | + 'fbsDialog' => 3, |
|
57 | + 'fbsSizable' => 4, |
|
58 | + 'fbsToolWindow' => 5, |
|
59 | + 'fbsSizableToolWindow' => 6, |
|
60 | + |
|
61 | + 'fwsNormal' => 0, |
|
62 | + 'fwsMinimized' => 1, |
|
63 | + 'fwsMaximized' => 2, |
|
64 | + |
|
65 | + 'fspManual' => 0, |
|
66 | + 'fspCenterScreen' => 1, |
|
67 | + 'fspWindowsDefaultLocation' => 2, |
|
68 | + 'fspWindowsDefaultBounds' => 3, |
|
69 | + 'fspCenterParent' => 4, |
|
70 | + |
|
71 | + # Константы стиля оконтовки |
|
72 | + |
|
73 | + 'bsNone' => 0, |
|
74 | + 'bsFixedSingle' => 1, |
|
75 | + 'bsFixed3D' => 2, |
|
76 | + |
|
77 | + # Константы выравнивания |
|
78 | + |
|
79 | + 'alTopLeft' => 1, |
|
80 | + 'alTopCenter' => 2, |
|
81 | + 'alTopRight' => 4, |
|
82 | + 'alMiddleLeft' => 16, |
|
83 | + 'alMiddleCenter' => 32, |
|
84 | + 'alMiddleRight' => 64, |
|
85 | + 'alBottomLeft' => 256, |
|
86 | + 'alBottomCenter' => 512, |
|
87 | + 'alBottomRight' => 1024, |
|
88 | + |
|
89 | + # Константы притягивания (Anchor) |
|
90 | + |
|
91 | + 'acNone' => 0, |
|
92 | + 'acTop' => 1, |
|
93 | + 'acBottom' => 2, |
|
94 | + 'acLeft' => 4, |
|
95 | + 'acRight' => 8, |
|
96 | + |
|
97 | + # Константы SizeMode-параметра PictureBox'а |
|
98 | + |
|
99 | + 'smNormal' => 0, |
|
100 | + 'smStretchImage' => 1, |
|
101 | + 'smAutoSize' => 2, |
|
102 | + 'smCenterImage' => 3, |
|
103 | + 'smZoom' => 4, |
|
104 | + |
|
105 | + # Константы View-параметра ListView'а |
|
106 | 106 | |
107 | - 'vwLargeIcon' => 0, |
|
108 | - 'vwDetails' => 1, |
|
109 | - 'vwSmallIcon' => 2, |
|
110 | - 'vwList' => 3, |
|
111 | - 'vwTile' => 4, |
|
107 | + 'vwLargeIcon' => 0, |
|
108 | + 'vwDetails' => 1, |
|
109 | + 'vwSmallIcon' => 2, |
|
110 | + 'vwList' => 3, |
|
111 | + 'vwTile' => 4, |
|
112 | 112 | |
113 | - # Константы dropDownStyle компонента ComboBox |
|
113 | + # Константы dropDownStyle компонента ComboBox |
|
114 | 114 | |
115 | - 'ddSimple' => 0, |
|
116 | - 'ddDropDown' => 1, |
|
117 | - 'ddDropDownList' => 2, |
|
115 | + 'ddSimple' => 0, |
|
116 | + 'ddDropDown' => 1, |
|
117 | + 'ddDropDownList' => 2, |
|
118 | 118 | |
119 | - # Константы причины закрытия формы |
|
119 | + # Константы причины закрытия формы |
|
120 | 120 | |
121 | - 'fcrNone' => 0, |
|
122 | - 'fcrWindowsShutDown' => 1, |
|
123 | - 'fcrMdiFormClosing' => 2, |
|
124 | - 'fcrUserClosing' => 3, |
|
125 | - 'fcrTaskManagerClosing' => 4, |
|
126 | - 'fcrFormOwnerClosing' => 5, |
|
127 | - 'fcrApplicationExitCall' => 6, |
|
121 | + 'fcrNone' => 0, |
|
122 | + 'fcrWindowsShutDown' => 1, |
|
123 | + 'fcrMdiFormClosing' => 2, |
|
124 | + 'fcrUserClosing' => 3, |
|
125 | + 'fcrTaskManagerClosing' => 4, |
|
126 | + 'fcrFormOwnerClosing' => 5, |
|
127 | + 'fcrApplicationExitCall' => 6, |
|
128 | 128 | |
129 | - # Константы дока |
|
129 | + # Константы дока |
|
130 | 130 | |
131 | - 'dsBottom' => 2, |
|
132 | - 'dsFill' => 5, |
|
133 | - 'dsLeft' => 3, |
|
134 | - 'dsNone' => 0, |
|
135 | - 'dsRight' => 4, |
|
136 | - 'dsTop' => 1, |
|
131 | + 'dsBottom' => 2, |
|
132 | + 'dsFill' => 5, |
|
133 | + 'dsLeft' => 3, |
|
134 | + 'dsNone' => 0, |
|
135 | + 'dsRight' => 4, |
|
136 | + 'dsTop' => 1, |
|
137 | 137 | |
138 | - # Константы FCTB.Language |
|
138 | + # Константы FCTB.Language |
|
139 | 139 | |
140 | - 'langCSharp' => 1, |
|
141 | - 'langCustom' => 2, |
|
142 | - 'langHTML' => 3, |
|
143 | - 'langJS' => 4, |
|
144 | - 'langLua' => 5, |
|
145 | - 'langPHP' => 6, |
|
146 | - 'langSQL' => 7, |
|
147 | - 'langVB' => 8, |
|
148 | - 'langXML' => 9, |
|
140 | + 'langCSharp' => 1, |
|
141 | + 'langCustom' => 2, |
|
142 | + 'langHTML' => 3, |
|
143 | + 'langJS' => 4, |
|
144 | + 'langLua' => 5, |
|
145 | + 'langPHP' => 6, |
|
146 | + 'langSQL' => 7, |
|
147 | + 'langVB' => 8, |
|
148 | + 'langXML' => 9, |
|
149 | 149 | |
150 | - # Константы видимости окна процесса |
|
150 | + # Константы видимости окна процесса |
|
151 | 151 | |
152 | - 'pwsHidden' => 0, |
|
153 | - 'pwsMaximized' => 3, |
|
154 | - 'pwsMinimized' => 2, |
|
155 | - 'pwsNormal' => 1, |
|
152 | + 'pwsHidden' => 0, |
|
153 | + 'pwsMaximized' => 3, |
|
154 | + 'pwsMinimized' => 2, |
|
155 | + 'pwsNormal' => 1, |
|
156 | 156 | |
157 | - # Константы запуска |
|
157 | + # Константы запуска |
|
158 | 158 | |
159 | - 'runNo' => 0, |
|
160 | - 'runYes' => 1, |
|
161 | - 'runThread' => 2, |
|
159 | + 'runNo' => 0, |
|
160 | + 'runYes' => 1, |
|
161 | + 'runThread' => 2, |
|
162 | 162 | |
163 | - # Константы стиля ProgressBar'а |
|
163 | + # Константы стиля ProgressBar'а |
|
164 | 164 | |
165 | - 'pbBlocks' => 0, |
|
166 | - 'pbContinuous' => 1, |
|
167 | - 'pbMarquee' => 2, |
|
165 | + 'pbBlocks' => 0, |
|
166 | + 'pbContinuous' => 1, |
|
167 | + 'pbMarquee' => 2, |
|
168 | 168 | |
169 | - # Константы свойства FlatStyle |
|
169 | + # Константы свойства FlatStyle |
|
170 | 170 | |
171 | - 'flFlat' => 0, |
|
172 | - 'flPopup' => 1, |
|
173 | - 'flStandard' => 2, |
|
174 | - 'flSystem' => 3, |
|
171 | + 'flFlat' => 0, |
|
172 | + 'flPopup' => 1, |
|
173 | + 'flStandard' => 2, |
|
174 | + 'flSystem' => 3, |
|
175 | 175 | |
176 | - # Константы свойства DrawMode |
|
176 | + # Константы свойства DrawMode |
|
177 | 177 | |
178 | - 'dwNormal' => 0, |
|
179 | - 'dwOwnerDrawFixed' => 1, |
|
180 | - 'dwOwnerDrawVariable' => 2, |
|
178 | + 'dwNormal' => 0, |
|
179 | + 'dwOwnerDrawFixed' => 1, |
|
180 | + 'dwOwnerDrawVariable' => 2, |
|
181 | 181 | |
182 | - # Константы свойства SizeMode PictureBox'а |
|
182 | + # Константы свойства SizeMode PictureBox'а |
|
183 | 183 | |
184 | - 'smNormal' => 0, |
|
185 | - 'smStretchImage' => 1, |
|
186 | - 'smAutoSize' => 2, |
|
187 | - 'smCenterImage' => 3, |
|
188 | - 'smZoom' => 4, |
|
184 | + 'smNormal' => 0, |
|
185 | + 'smStretchImage' => 1, |
|
186 | + 'smAutoSize' => 2, |
|
187 | + 'smCenterImage' => 3, |
|
188 | + 'smZoom' => 4, |
|
189 | 189 | |
190 | - # Цветовые константы |
|
190 | + # Цветовые константы |
|
191 | 191 | |
192 | - 'clAliceBlue' => 0xFFF0F8FF, |
|
193 | - 'clAntiqueWhite' => 0xFFFAEBD7, |
|
194 | - 'clAqua' => 0xFF00FFFF, |
|
195 | - 'clAquamarine' => 0xFF7FFFD4, |
|
196 | - 'clAzure' => 0xFFF0FFFF, |
|
197 | - 'clBeige' => 0xFFF5F5DC, |
|
198 | - 'clBisque' => 0xFFFFE4C4, |
|
199 | - 'clBlack' => 0xFF000000, |
|
200 | - 'clBlanchedAlmond' => 0xFFFFEBCD, |
|
201 | - 'clBlue' => 0xFF0000FF, |
|
202 | - 'clBlueViolet' => 0xFF8A2BE2, |
|
203 | - 'clBrown' => 0xFFA52A2A, |
|
204 | - 'clBurlyWood' => 0xFFDEB887, |
|
205 | - 'clCadetBlue' => 0xFF5F9EA0, |
|
206 | - 'clChartreuse' => 0xFF7FFF00, |
|
207 | - 'clChocolate' => 0xFFD2691E, |
|
208 | - 'clCoral' => 0xFFFF7F50, |
|
209 | - 'clCornflowerBlue' => 0xFF6495ED, |
|
210 | - 'clCornsilk' => 0xFFFFF8DC, |
|
211 | - 'clCrimson' => 0xFFDC143C, |
|
212 | - 'clCyan' => 0xFF00FFFF, |
|
213 | - 'clDarkBlue' => 0xFF00008B, |
|
214 | - 'clDarkCyan' => 0xFF008B8B, |
|
215 | - 'clDarkGoldenrod' => 0xFFB8860B, |
|
216 | - 'clDarkGray' => 0xFFA9A9A9, |
|
217 | - 'clDarkGreen' => 0xFF006400, |
|
218 | - 'clDarkKhaki' => 0xFFBDB76B, |
|
219 | - 'clDarkMagenta' => 0xFF8B008B, |
|
220 | - 'clDarkOliveGreen' => 0xFF556B2F, |
|
221 | - 'clDarkOrange' => 0xFFFF8C00, |
|
222 | - 'clDarkOrchid' => 0xFF9932CC, |
|
223 | - 'clDarkRed' => 0xFF8B0000, |
|
224 | - 'clDarkSalmon' => 0xFFE9967A, |
|
225 | - 'clDarkSeaGreen' => 0xFF8FBC8F, |
|
226 | - 'clDarkSlateBlue' => 0xFF483D8B, |
|
227 | - 'clDarkSlateGray' => 0xFF2F4F4F, |
|
228 | - 'clDarkTurquoise' => 0xFF00CED1, |
|
229 | - 'clDarkViolet' => 0xFF9400D3, |
|
230 | - 'clDeepPink' => 0xFFFF1493, |
|
231 | - 'clDeepSkyBlue' => 0xFF00BFFF, |
|
232 | - 'clDimGray' => 0xFF696969, |
|
233 | - 'clDodgerBlue' => 0xFF1E90FF, |
|
234 | - 'clFirebrick' => 0xFFB22222, |
|
235 | - 'clFloralWhite' => 0xFFFFFAF0, |
|
236 | - 'clForestGreen' => 0xFF228B22, |
|
237 | - 'clFuchsia' => 0xFFFF00FF, |
|
238 | - 'clGainsboro' => 0xFFDCDCDC, |
|
239 | - 'clGhostWhite' => 0xFFF8F8FF, |
|
240 | - 'clGold' => 0xFFFFD700, |
|
241 | - 'clGoldenrod' => 0xFFDAA520, |
|
242 | - 'clGray' => 0xFF808080, |
|
243 | - 'clGreen' => 0xFF008000, |
|
244 | - 'clGreenYellow' => 0xFFADFF2F, |
|
245 | - 'clHoneydew' => 0xFFF0FFF0, |
|
246 | - 'clHotPink' => 0xFFFF69B4, |
|
247 | - 'clIndianRed' => 0xFFCD5C5C, |
|
248 | - 'clIndigo' => 0xFF4B0082, |
|
249 | - 'clIvory' => 0xFFFFFFF0, |
|
250 | - 'clKhaki' => 0xFFF0E68C, |
|
251 | - 'clLavender' => 0xFFE6E6FA, |
|
252 | - 'clLavenderBlush' => 0xFFFFF0F5, |
|
253 | - 'clLawnGreen' => 0xFF7CFC00, |
|
254 | - 'clLemonChiffon' => 0xFFFFFACD, |
|
255 | - 'clLightBlue' => 0xFFADD8E6, |
|
256 | - 'clLightCoral' => 0xFFF08080, |
|
257 | - 'clLightCyan' => 0xFFE0FFFF, |
|
258 | - 'clLightGoldenrodYellow' => 0xFFFAFAD2, |
|
259 | - 'clLightGray' => 0xFFD3D3D3, |
|
260 | - 'clLightGreen' => 0xFF90EE90, |
|
261 | - 'clLightPink' => 0xFFFFB6C1, |
|
262 | - 'clLightSalmon' => 0xFFFFA07A, |
|
263 | - 'clLightSeaGreen' => 0xFF20B2AA, |
|
264 | - 'clLightSkyBlue' => 0xFF87CEFA, |
|
265 | - 'clLightSlateGray' => 0xFF778899, |
|
266 | - 'clLightSteelBlue' => 0xFFB0C4DE, |
|
267 | - 'clLightYellow' => 0xFFFFFFE0, |
|
268 | - 'clLime' => 0xFF00FF00, |
|
269 | - 'clLimeGreen' => 0xFF32CD32, |
|
270 | - 'clLinen' => 0xFFFAF0E6, |
|
271 | - 'clMagenta' => 0xFFFF00FF, |
|
272 | - 'clMaroon' => 0xFF800000, |
|
273 | - 'clMediumAquamarine' => 0xFF66CDAA, |
|
274 | - 'clMediumBlue' => 0xFF0000CD, |
|
275 | - 'clMediumOrchid' => 0xFFBA55D3, |
|
276 | - 'clMediumPurple' => 0xFF9370DB, |
|
277 | - 'clMediumSeaGreen' => 0xFF3CB371, |
|
278 | - 'clMediumSlateBlue' => 0xFF7B68EE, |
|
279 | - 'clMediumSpringGreen' => 0xFF00FA9A, |
|
280 | - 'clMediumTurquoise' => 0xFF48D1CC, |
|
281 | - 'clMediumVioletRed' => 0xFFC71585, |
|
282 | - 'clMidnightBlue' => 0xFF191970, |
|
283 | - 'clMintCream' => 0xFFF5FFFA, |
|
284 | - 'clMistyRose' => 0xFFFFE4E1, |
|
285 | - 'clMoccasin' => 0xFFFFE4B5, |
|
286 | - 'clNavajoWhite' => 0xFFFFDEAD, |
|
287 | - 'clNavy' => 0xFF000080, |
|
288 | - 'clOldLace' => 0xFFFDF5E6, |
|
289 | - 'clOlive' => 0xFF808000, |
|
290 | - 'clOliveDrab' => 0xFF6B8E23, |
|
291 | - 'clOrange' => 0xFFFFA500, |
|
292 | - 'clOrangeRed' => 0xFFFF4500, |
|
293 | - 'clOrchid' => 0xFFDA70D6, |
|
294 | - 'clPaleGoldenrod' => 0xFFEEE8AA, |
|
295 | - 'clPaleGreen' => 0xFF98FB98, |
|
296 | - 'clPaleTurquoise' => 0xFFAFEEEE, |
|
297 | - 'clPaleVioletRed' => 0xFFDB7093, |
|
298 | - 'clPapayaWhip' => 0xFFFFEFD5, |
|
299 | - 'clPeachPuff' => 0xFFFFDAB9, |
|
300 | - 'clPeru' => 0xFFCD853F, |
|
301 | - 'clPink' => 0xFFFFC0CB, |
|
302 | - 'clPlum' => 0xFFDDA0DD, |
|
303 | - 'clPowderBlue' => 0xFFB0E0E6, |
|
304 | - 'clPurple' => 0xFF800080, |
|
305 | - 'clRed' => 0xFFFF0000, |
|
306 | - 'clRosyBrown' => 0xFFBC8F8F, |
|
307 | - 'clRoyalBlue' => 0xFF4169E1, |
|
308 | - 'clSaddleBrown' => 0xFF8B4513, |
|
309 | - 'clSalmon' => 0xFFFA8072, |
|
310 | - 'clSandyBrown' => 0xFFF4A460, |
|
311 | - 'clSeaGreen' => 0xFF2E8B57, |
|
312 | - 'clSeaShell' => 0xFFFFF5EE, |
|
313 | - 'clSienna' => 0xFFA0522D, |
|
314 | - 'clSilver' => 0xFFC0C0C0, |
|
315 | - 'clSkyBlue' => 0xFF87CEEB, |
|
316 | - 'clSlateBlue' => 0xFF6A5ACD, |
|
317 | - 'clSlateGray' => 0xFF708090, |
|
318 | - 'clSnow' => 0xFFFFFAFA, |
|
319 | - 'clSpringGreen' => 0xFF00FF7F, |
|
320 | - 'clSteelBlue' => 0xFF4682B4, |
|
321 | - 'clTan' => 0xFFD2B48C, |
|
322 | - 'clTeal' => 0xFF008080, |
|
323 | - 'clThistle' => 0xFFD8BFD8, |
|
324 | - 'clTomato' => 0xFFFF6347, |
|
325 | - 'clTurquoise' => 0xFF40E0D0, |
|
326 | - 'clViolet' => 0xFFEE82EE, |
|
327 | - 'clWheat' => 0xFFF5DEB3, |
|
328 | - 'clWhite' => 0xFFFFFFFF, |
|
329 | - 'clWhiteSmoke' => 0xFFF5F5F5, |
|
330 | - 'clYellow' => 0xFFFFFF00, |
|
331 | - 'clYellowGreen' => 0xFF9ACD32, |
|
332 | - |
|
333 | - # Моя подборка цветов |
|
334 | - |
|
335 | - 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | - 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | - 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | - 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
192 | + 'clAliceBlue' => 0xFFF0F8FF, |
|
193 | + 'clAntiqueWhite' => 0xFFFAEBD7, |
|
194 | + 'clAqua' => 0xFF00FFFF, |
|
195 | + 'clAquamarine' => 0xFF7FFFD4, |
|
196 | + 'clAzure' => 0xFFF0FFFF, |
|
197 | + 'clBeige' => 0xFFF5F5DC, |
|
198 | + 'clBisque' => 0xFFFFE4C4, |
|
199 | + 'clBlack' => 0xFF000000, |
|
200 | + 'clBlanchedAlmond' => 0xFFFFEBCD, |
|
201 | + 'clBlue' => 0xFF0000FF, |
|
202 | + 'clBlueViolet' => 0xFF8A2BE2, |
|
203 | + 'clBrown' => 0xFFA52A2A, |
|
204 | + 'clBurlyWood' => 0xFFDEB887, |
|
205 | + 'clCadetBlue' => 0xFF5F9EA0, |
|
206 | + 'clChartreuse' => 0xFF7FFF00, |
|
207 | + 'clChocolate' => 0xFFD2691E, |
|
208 | + 'clCoral' => 0xFFFF7F50, |
|
209 | + 'clCornflowerBlue' => 0xFF6495ED, |
|
210 | + 'clCornsilk' => 0xFFFFF8DC, |
|
211 | + 'clCrimson' => 0xFFDC143C, |
|
212 | + 'clCyan' => 0xFF00FFFF, |
|
213 | + 'clDarkBlue' => 0xFF00008B, |
|
214 | + 'clDarkCyan' => 0xFF008B8B, |
|
215 | + 'clDarkGoldenrod' => 0xFFB8860B, |
|
216 | + 'clDarkGray' => 0xFFA9A9A9, |
|
217 | + 'clDarkGreen' => 0xFF006400, |
|
218 | + 'clDarkKhaki' => 0xFFBDB76B, |
|
219 | + 'clDarkMagenta' => 0xFF8B008B, |
|
220 | + 'clDarkOliveGreen' => 0xFF556B2F, |
|
221 | + 'clDarkOrange' => 0xFFFF8C00, |
|
222 | + 'clDarkOrchid' => 0xFF9932CC, |
|
223 | + 'clDarkRed' => 0xFF8B0000, |
|
224 | + 'clDarkSalmon' => 0xFFE9967A, |
|
225 | + 'clDarkSeaGreen' => 0xFF8FBC8F, |
|
226 | + 'clDarkSlateBlue' => 0xFF483D8B, |
|
227 | + 'clDarkSlateGray' => 0xFF2F4F4F, |
|
228 | + 'clDarkTurquoise' => 0xFF00CED1, |
|
229 | + 'clDarkViolet' => 0xFF9400D3, |
|
230 | + 'clDeepPink' => 0xFFFF1493, |
|
231 | + 'clDeepSkyBlue' => 0xFF00BFFF, |
|
232 | + 'clDimGray' => 0xFF696969, |
|
233 | + 'clDodgerBlue' => 0xFF1E90FF, |
|
234 | + 'clFirebrick' => 0xFFB22222, |
|
235 | + 'clFloralWhite' => 0xFFFFFAF0, |
|
236 | + 'clForestGreen' => 0xFF228B22, |
|
237 | + 'clFuchsia' => 0xFFFF00FF, |
|
238 | + 'clGainsboro' => 0xFFDCDCDC, |
|
239 | + 'clGhostWhite' => 0xFFF8F8FF, |
|
240 | + 'clGold' => 0xFFFFD700, |
|
241 | + 'clGoldenrod' => 0xFFDAA520, |
|
242 | + 'clGray' => 0xFF808080, |
|
243 | + 'clGreen' => 0xFF008000, |
|
244 | + 'clGreenYellow' => 0xFFADFF2F, |
|
245 | + 'clHoneydew' => 0xFFF0FFF0, |
|
246 | + 'clHotPink' => 0xFFFF69B4, |
|
247 | + 'clIndianRed' => 0xFFCD5C5C, |
|
248 | + 'clIndigo' => 0xFF4B0082, |
|
249 | + 'clIvory' => 0xFFFFFFF0, |
|
250 | + 'clKhaki' => 0xFFF0E68C, |
|
251 | + 'clLavender' => 0xFFE6E6FA, |
|
252 | + 'clLavenderBlush' => 0xFFFFF0F5, |
|
253 | + 'clLawnGreen' => 0xFF7CFC00, |
|
254 | + 'clLemonChiffon' => 0xFFFFFACD, |
|
255 | + 'clLightBlue' => 0xFFADD8E6, |
|
256 | + 'clLightCoral' => 0xFFF08080, |
|
257 | + 'clLightCyan' => 0xFFE0FFFF, |
|
258 | + 'clLightGoldenrodYellow' => 0xFFFAFAD2, |
|
259 | + 'clLightGray' => 0xFFD3D3D3, |
|
260 | + 'clLightGreen' => 0xFF90EE90, |
|
261 | + 'clLightPink' => 0xFFFFB6C1, |
|
262 | + 'clLightSalmon' => 0xFFFFA07A, |
|
263 | + 'clLightSeaGreen' => 0xFF20B2AA, |
|
264 | + 'clLightSkyBlue' => 0xFF87CEFA, |
|
265 | + 'clLightSlateGray' => 0xFF778899, |
|
266 | + 'clLightSteelBlue' => 0xFFB0C4DE, |
|
267 | + 'clLightYellow' => 0xFFFFFFE0, |
|
268 | + 'clLime' => 0xFF00FF00, |
|
269 | + 'clLimeGreen' => 0xFF32CD32, |
|
270 | + 'clLinen' => 0xFFFAF0E6, |
|
271 | + 'clMagenta' => 0xFFFF00FF, |
|
272 | + 'clMaroon' => 0xFF800000, |
|
273 | + 'clMediumAquamarine' => 0xFF66CDAA, |
|
274 | + 'clMediumBlue' => 0xFF0000CD, |
|
275 | + 'clMediumOrchid' => 0xFFBA55D3, |
|
276 | + 'clMediumPurple' => 0xFF9370DB, |
|
277 | + 'clMediumSeaGreen' => 0xFF3CB371, |
|
278 | + 'clMediumSlateBlue' => 0xFF7B68EE, |
|
279 | + 'clMediumSpringGreen' => 0xFF00FA9A, |
|
280 | + 'clMediumTurquoise' => 0xFF48D1CC, |
|
281 | + 'clMediumVioletRed' => 0xFFC71585, |
|
282 | + 'clMidnightBlue' => 0xFF191970, |
|
283 | + 'clMintCream' => 0xFFF5FFFA, |
|
284 | + 'clMistyRose' => 0xFFFFE4E1, |
|
285 | + 'clMoccasin' => 0xFFFFE4B5, |
|
286 | + 'clNavajoWhite' => 0xFFFFDEAD, |
|
287 | + 'clNavy' => 0xFF000080, |
|
288 | + 'clOldLace' => 0xFFFDF5E6, |
|
289 | + 'clOlive' => 0xFF808000, |
|
290 | + 'clOliveDrab' => 0xFF6B8E23, |
|
291 | + 'clOrange' => 0xFFFFA500, |
|
292 | + 'clOrangeRed' => 0xFFFF4500, |
|
293 | + 'clOrchid' => 0xFFDA70D6, |
|
294 | + 'clPaleGoldenrod' => 0xFFEEE8AA, |
|
295 | + 'clPaleGreen' => 0xFF98FB98, |
|
296 | + 'clPaleTurquoise' => 0xFFAFEEEE, |
|
297 | + 'clPaleVioletRed' => 0xFFDB7093, |
|
298 | + 'clPapayaWhip' => 0xFFFFEFD5, |
|
299 | + 'clPeachPuff' => 0xFFFFDAB9, |
|
300 | + 'clPeru' => 0xFFCD853F, |
|
301 | + 'clPink' => 0xFFFFC0CB, |
|
302 | + 'clPlum' => 0xFFDDA0DD, |
|
303 | + 'clPowderBlue' => 0xFFB0E0E6, |
|
304 | + 'clPurple' => 0xFF800080, |
|
305 | + 'clRed' => 0xFFFF0000, |
|
306 | + 'clRosyBrown' => 0xFFBC8F8F, |
|
307 | + 'clRoyalBlue' => 0xFF4169E1, |
|
308 | + 'clSaddleBrown' => 0xFF8B4513, |
|
309 | + 'clSalmon' => 0xFFFA8072, |
|
310 | + 'clSandyBrown' => 0xFFF4A460, |
|
311 | + 'clSeaGreen' => 0xFF2E8B57, |
|
312 | + 'clSeaShell' => 0xFFFFF5EE, |
|
313 | + 'clSienna' => 0xFFA0522D, |
|
314 | + 'clSilver' => 0xFFC0C0C0, |
|
315 | + 'clSkyBlue' => 0xFF87CEEB, |
|
316 | + 'clSlateBlue' => 0xFF6A5ACD, |
|
317 | + 'clSlateGray' => 0xFF708090, |
|
318 | + 'clSnow' => 0xFFFFFAFA, |
|
319 | + 'clSpringGreen' => 0xFF00FF7F, |
|
320 | + 'clSteelBlue' => 0xFF4682B4, |
|
321 | + 'clTan' => 0xFFD2B48C, |
|
322 | + 'clTeal' => 0xFF008080, |
|
323 | + 'clThistle' => 0xFFD8BFD8, |
|
324 | + 'clTomato' => 0xFFFF6347, |
|
325 | + 'clTurquoise' => 0xFF40E0D0, |
|
326 | + 'clViolet' => 0xFFEE82EE, |
|
327 | + 'clWheat' => 0xFFF5DEB3, |
|
328 | + 'clWhite' => 0xFFFFFFFF, |
|
329 | + 'clWhiteSmoke' => 0xFFF5F5F5, |
|
330 | + 'clYellow' => 0xFFFFFF00, |
|
331 | + 'clYellowGreen' => 0xFF9ACD32, |
|
332 | + |
|
333 | + # Моя подборка цветов |
|
334 | + |
|
335 | + 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | + 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | + 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | + 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
339 | 339 | ]; |
340 | 340 | |
341 | 341 | foreach ($constants as $name => $value) |
342 | - define ($name, $value); |
|
342 | + define ($name, $value); |
|
343 | 343 | |
344 | 344 | $argv = START_PARAMS; |
345 | 345 | $argc = sizeof ($argv); |
@@ -2,17 +2,17 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace VoidEngine; |
4 | 4 | |
5 | -$env = new WFClass ('System.Environment', 'mscorlib'); |
|
6 | -$params = $env->getCommandLineArgs ()->list; |
|
5 | +$env = new WFClass('System.Environment', 'mscorlib'); |
|
6 | +$params = $env->getCommandLineArgs()->list; |
|
7 | 7 | |
8 | -$converter = new WFClass ('System.Drawing.ColorTranslator'); |
|
8 | +$converter = new WFClass('System.Drawing.ColorTranslator'); |
|
9 | 9 | |
10 | 10 | $constants = [ |
11 | 11 | # Информация об окружении |
12 | 12 | |
13 | 13 | 'EXE_NAME' => $APPLICATION->executablePath, |
14 | - 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | - 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
14 | + 'DOC_ROOT' => dirname($APPLICATION->executablePath), |
|
15 | + 'IS_ADMIN' => is_writable(getenv('SystemRoot')), |
|
16 | 16 | 'START_PARAMS' => $params, |
17 | 17 | 'USERNAME' => $env->username, |
18 | 18 | |
@@ -332,17 +332,17 @@ discard block |
||
332 | 332 | |
333 | 333 | # Моя подборка цветов |
334 | 334 | |
335 | - 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | - 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | - 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | - 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
335 | + 'clDark' => $converter->fromHtml('#0D0F12'), |
|
336 | + 'clDark2' => $converter->fromHtml('#121416'), |
|
337 | + 'clTurquoise' => $converter->fromHtml('#00ADB5'), |
|
338 | + 'clLight' => $converter->fromHtml('#EEEEEE') |
|
339 | 339 | ]; |
340 | 340 | |
341 | 341 | foreach ($constants as $name => $value) |
342 | - define ($name, $value); |
|
342 | + define($name, $value); |
|
343 | 343 | |
344 | 344 | $argv = START_PARAMS; |
345 | -$argc = sizeof ($argv); |
|
345 | +$argc = sizeof($argv); |
|
346 | 346 | |
347 | -VoidEngine::removeObjects ($converter->selector); |
|
347 | +VoidEngine::removeObjects($converter->selector); |
|
348 | 348 | unset ($constants, $env, $params, $converter); |
@@ -338,8 +338,9 @@ |
||
338 | 338 | 'clLight' => $converter->fromHtml ('#EEEEEE') |
339 | 339 | ]; |
340 | 340 | |
341 | -foreach ($constants as $name => $value) |
|
341 | +foreach ($constants as $name => $value) { |
|
342 | 342 | define ($name, $value); |
343 | +} |
|
343 | 344 | |
344 | 345 | $argv = START_PARAMS; |
345 | 346 | $argc = sizeof ($argv); |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | public static function setObjectEvent (int $object, string $eventName, callable $function) |
8 | 8 | { |
9 | 9 | VoidEngine::setObjectEvent ($object, $eventName, function ($sender, ...$args) use ($function) |
10 | - { |
|
10 | + { |
|
11 | 11 | try |
12 | - { |
|
12 | + { |
|
13 | 13 | foreach ($args as $id => $arg) |
14 | 14 | $args[$id] = EngineAdditions::coupleSelector ($arg); |
15 | 15 | |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $e : new WFObject ($sender), ...$args); |
18 | 18 | } |
19 | 19 | |
20 | - catch (\Throwable $e) |
|
21 | - { |
|
20 | + catch (\Throwable $e) |
|
21 | + { |
|
22 | 22 | message ([ |
23 | 23 | 'type' => get_class ($e), |
24 | 24 | 'text' => $e->getMessage (), |
@@ -4,35 +4,35 @@ |
||
4 | 4 | |
5 | 5 | class Events |
6 | 6 | { |
7 | - public static function setObjectEvent (int $object, string $eventName, callable $function) |
|
7 | + public static function setObjectEvent(int $object, string $eventName, callable $function) |
|
8 | 8 | { |
9 | - VoidEngine::setObjectEvent ($object, $eventName, function ($sender, ...$args) use ($function) |
|
9 | + VoidEngine::setObjectEvent($object, $eventName, function($sender, ...$args) use ($function) |
|
10 | 10 | { |
11 | 11 | try |
12 | 12 | { |
13 | 13 | foreach ($args as $id => $arg) |
14 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
14 | + $args[$id] = EngineAdditions::coupleSelector($arg); |
|
15 | 15 | |
16 | - return $function (($e = _c($sender)) !== false ? |
|
17 | - $e : new WFObject ($sender), ...$args); |
|
16 | + return $function(($e = _c($sender)) !== false ? |
|
17 | + $e : new WFObject($sender), ...$args); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | catch (\Throwable $e) |
21 | 21 | { |
22 | - message ([ |
|
23 | - 'type' => get_class ($e), |
|
24 | - 'text' => $e->getMessage (), |
|
25 | - 'file' => $e->getFile (), |
|
26 | - 'line' => $e->getLine (), |
|
27 | - 'code' => $e->getCode (), |
|
28 | - 'trace' => $e->getTraceAsString () |
|
22 | + message([ |
|
23 | + 'type' => get_class($e), |
|
24 | + 'text' => $e->getMessage(), |
|
25 | + 'file' => $e->getFile(), |
|
26 | + 'line' => $e->getLine(), |
|
27 | + 'code' => $e->getCode(), |
|
28 | + 'trace' => $e->getTraceAsString() |
|
29 | 29 | ], 'PHP Critical Error'); |
30 | 30 | } |
31 | 31 | }); |
32 | 32 | } |
33 | 33 | |
34 | - public static function removeObjectEvent (int $object, string $eventName) |
|
34 | + public static function removeObjectEvent(int $object, string $eventName) |
|
35 | 35 | { |
36 | - VoidEngine::removeObjectEvent ($object, $eventName); |
|
36 | + VoidEngine::removeObjectEvent($object, $eventName); |
|
37 | 37 | } |
38 | 38 | } |
@@ -10,14 +10,13 @@ |
||
10 | 10 | { |
11 | 11 | try |
12 | 12 | { |
13 | - foreach ($args as $id => $arg) |
|
14 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
13 | + foreach ($args as $id => $arg) { |
|
14 | + $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
15 | + } |
|
15 | 16 | |
16 | 17 | return $function (($e = _c($sender)) !== false ? |
17 | 18 | $e : new WFObject ($sender), ...$args); |
18 | - } |
|
19 | - |
|
20 | - catch (\Throwable $e) |
|
19 | + } catch (\Throwable $e) |
|
21 | 20 | { |
22 | 21 | message ([ |
23 | 22 | 'type' => get_class ($e), |
@@ -7,43 +7,43 @@ discard block |
||
7 | 7 | public $application; |
8 | 8 | public $executablePath; |
9 | 9 | |
10 | - public function __construct () |
|
10 | + public function __construct() |
|
11 | 11 | { |
12 | - $this->application = new WFClass ('System.Windows.Forms.Application'); |
|
12 | + $this->application = new WFClass('System.Windows.Forms.Application'); |
|
13 | 13 | $this->executablePath = $this->application->executablePath; |
14 | 14 | } |
15 | 15 | |
16 | - public function run ($form = null): void |
|
16 | + public function run($form = null): void |
|
17 | 17 | { |
18 | 18 | if ($form instanceof WFObject) |
19 | - $this->application->run ($form->selector); |
|
19 | + $this->application->run($form->selector); |
|
20 | 20 | |
21 | - elseif (is_int ($form) && VoidEngine::objectExists ($form)) |
|
22 | - $this->application->run ($form); |
|
21 | + elseif (is_int($form) && VoidEngine::objectExists($form)) |
|
22 | + $this->application->run($form); |
|
23 | 23 | |
24 | 24 | elseif ($form === null) |
25 | - $this->application->run (); |
|
25 | + $this->application->run(); |
|
26 | 26 | |
27 | - else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
27 | + else throw new \Exception('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
28 | 28 | } |
29 | 29 | |
30 | - public function restart (): void |
|
30 | + public function restart(): void |
|
31 | 31 | { |
32 | - $this->application->restart (); |
|
33 | - $this->close (); |
|
32 | + $this->application->restart(); |
|
33 | + $this->close(); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function close (): void |
|
36 | + public function close(): void |
|
37 | 37 | { |
38 | - $this->application->exit (); |
|
38 | + $this->application->exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function __call (string $name, array $args) |
|
41 | + public function __call(string $name, array $args) |
|
42 | 42 | { |
43 | - return $this->application->$name (...$args); |
|
43 | + return $this->application->$name(...$args); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function __get (string $name) |
|
46 | + public function __get(string $name) |
|
47 | 47 | { |
48 | 48 | return $this->application->$name; |
49 | 49 | } |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | { |
54 | 54 | public $screen; |
55 | 55 | |
56 | - public function __construct () |
|
56 | + public function __construct() |
|
57 | 57 | { |
58 | - $this->screen = new WFClass ('System.Windows.Forms.Screen'); |
|
58 | + $this->screen = new WFClass('System.Windows.Forms.Screen'); |
|
59 | 59 | } |
60 | 60 | |
61 | - public function __get ($name) |
|
61 | + public function __get($name) |
|
62 | 62 | { |
63 | - switch (strtolower ($name)) |
|
63 | + switch (strtolower($name)) |
|
64 | 64 | { |
65 | 65 | case 'width': |
66 | 66 | case 'w': |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - public function __debugInfo (): array |
|
81 | + public function __debugInfo(): array |
|
82 | 82 | { |
83 | 83 | return [ |
84 | 84 | $this->w, |
@@ -15,16 +15,15 @@ |
||
15 | 15 | |
16 | 16 | public function run ($form = null): void |
17 | 17 | { |
18 | - if ($form instanceof WFObject) |
|
19 | - $this->application->run ($form->selector); |
|
20 | - |
|
21 | - elseif (is_int ($form) && VoidEngine::objectExists ($form)) |
|
22 | - $this->application->run ($form); |
|
23 | - |
|
24 | - elseif ($form === null) |
|
25 | - $this->application->run (); |
|
26 | - |
|
27 | - else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
18 | + if ($form instanceof WFObject) { |
|
19 | + $this->application->run ($form->selector); |
|
20 | + } elseif (is_int ($form) && VoidEngine::objectExists ($form)) { |
|
21 | + $this->application->run ($form); |
|
22 | + } elseif ($form === null) { |
|
23 | + $this->application->run (); |
|
24 | + } else { |
|
25 | + throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
26 | + } |
|
28 | 27 | } |
29 | 28 | |
30 | 29 | public function restart (): void |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | return [ |
49 | 49 | 'text' => $e->getMessage (), |
50 | - 'line' => $e->getLine () |
|
50 | + 'line' => $e->getLine () |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | function substr_icount (string $haystack, string $needle, ...$params): int |
167 | 167 | { |
168 | - return substr_count (strtolower ($haystack), strtolower ($needle), ...$params); |
|
168 | + return substr_count (strtolower ($haystack), strtolower ($needle), ...$params); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | function str_replace_assoc (string $subject, array $replacements): string |
172 | 172 | { |
173 | - return str_replace (array_keys ($replacements), array_values ($replacements), $subject); |
|
173 | + return str_replace (array_keys ($replacements), array_values ($replacements), $subject); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | function pre (...$args): void |
177 | 177 | { |
178 | - message (sizeof ($args) < 2 ? current ($args) : $args); |
|
178 | + message (sizeof ($args) < 2 ? current ($args) : $args); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | function messageBox (string $message, string $caption = '', ...$args) |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | catch (\Throwable $e) |
311 | - { |
|
312 | - continue; |
|
313 | - } |
|
311 | + { |
|
312 | + continue; |
|
313 | + } |
|
314 | 314 | |
315 | 315 | return false; |
316 | 316 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | call_user_func ($function, $self); |
334 | 334 | }; |
335 | 335 | |
336 | - $timer->start (); |
|
336 | + $timer->start (); |
|
337 | 337 | |
338 | 338 | return $timer; |
339 | 339 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $timer->start (); |
355 | 355 | |
356 | - return $timer; |
|
356 | + return $timer; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | class Clipboard |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace VoidEngine; |
4 | 4 | |
5 | -function err_status (bool $status = null): bool |
|
5 | +function err_status(bool $status = null): bool |
|
6 | 6 | { |
7 | 7 | $oldStatus = $GLOBALS['error_status']; |
8 | 8 | |
@@ -12,203 +12,203 @@ discard block |
||
12 | 12 | return $oldStatus; |
13 | 13 | } |
14 | 14 | |
15 | -function err_no (): bool |
|
15 | +function err_no(): bool |
|
16 | 16 | { |
17 | - return err_status (false); |
|
17 | + return err_status(false); |
|
18 | 18 | } |
19 | 19 | |
20 | -function err_yes (): bool |
|
20 | +function err_yes(): bool |
|
21 | 21 | { |
22 | - return err_status (true); |
|
22 | + return err_status(true); |
|
23 | 23 | } |
24 | 24 | |
25 | -function run (string $path, ...$args) |
|
25 | +function run(string $path, ...$args) |
|
26 | 26 | { |
27 | - return (new Process)->start ($path, ...$args); |
|
27 | + return (new Process)->start($path, ...$args); |
|
28 | 28 | } |
29 | 29 | |
30 | -function vbs_exec (string $code) |
|
30 | +function vbs_exec(string $code) |
|
31 | 31 | { |
32 | - file_put_contents ($path = getenv ('temp') .'/'. crc32 ($code) .'.vbs', $code); |
|
32 | + file_put_contents($path = getenv('temp').'/'.crc32($code).'.vbs', $code); |
|
33 | 33 | |
34 | - (new \COM ('WScript.Shell'))->Run ($path, 0, true); |
|
34 | + (new \COM('WScript.Shell'))->Run($path, 0, true); |
|
35 | 35 | |
36 | - unlink ($path); |
|
36 | + unlink($path); |
|
37 | 37 | } |
38 | 38 | |
39 | -function php_errors_check (string $code): ?array |
|
39 | +function php_errors_check(string $code): ?array |
|
40 | 40 | { |
41 | 41 | try |
42 | 42 | { |
43 | - eval ('return; '. $code); |
|
43 | + eval ('return; '.$code); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | catch (\Throwable $e) |
47 | 47 | { |
48 | 48 | return [ |
49 | - 'text' => $e->getMessage (), |
|
50 | - 'line' => $e->getLine () |
|
49 | + 'text' => $e->getMessage(), |
|
50 | + 'line' => $e->getLine() |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | |
57 | -function enum (string $name): array |
|
57 | +function enum(string $name): array |
|
58 | 58 | { |
59 | 59 | return [ |
60 | - substr ($name, strrpos ($name, '.') + 1), |
|
61 | - ($name = substr ($name, 0, strrpos ($name, '.'))) .', '. substr ($name, 0, strrpos ($name, '.')) |
|
60 | + substr($name, strrpos($name, '.') + 1), |
|
61 | + ($name = substr($name, 0, strrpos($name, '.'))).', '.substr($name, 0, strrpos($name, '.')) |
|
62 | 62 | ]; |
63 | 63 | } |
64 | 64 | |
65 | -function getNetArray (string $type, array $items = []): WFObject |
|
65 | +function getNetArray(string $type, array $items = []): WFObject |
|
66 | 66 | { |
67 | - $array = (new WFClass ('System.Array', null)) |
|
68 | - ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items)); |
|
67 | + $array = (new WFClass('System.Array', null)) |
|
68 | + ->createInstance(VoidEngine::objectType($type), $size = sizeof($items)); |
|
69 | 69 | |
70 | 70 | for ($i = 0; $i < $size; ++$i) |
71 | - $array[$i] = array_shift ($items); |
|
71 | + $array[$i] = array_shift($items); |
|
72 | 72 | |
73 | 73 | return $array; |
74 | 74 | } |
75 | 75 | |
76 | -function dir_create (string $path, int $mode = 0777): void |
|
76 | +function dir_create(string $path, int $mode = 0777): void |
|
77 | 77 | { |
78 | - if (!is_dir ($path)) |
|
79 | - mkdir ($path, $mode, true); |
|
78 | + if (!is_dir($path)) |
|
79 | + mkdir($path, $mode, true); |
|
80 | 80 | } |
81 | 81 | |
82 | -function dir_delete (string $path): bool |
|
82 | +function dir_delete(string $path): bool |
|
83 | 83 | { |
84 | - if (!is_dir ($path)) |
|
84 | + if (!is_dir($path)) |
|
85 | 85 | return false; |
86 | 86 | |
87 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
88 | - if (is_dir ($file = $path .'/'. $file)) |
|
87 | + foreach (array_slice(scandir($path), 2) as $file) |
|
88 | + if (is_dir($file = $path.'/'.$file)) |
|
89 | 89 | { |
90 | - dir_delete ($file); |
|
90 | + dir_delete($file); |
|
91 | 91 | |
92 | - if (is_dir ($file)) |
|
93 | - rmdir ($file); |
|
92 | + if (is_dir($file)) |
|
93 | + rmdir($file); |
|
94 | 94 | } |
95 | 95 | |
96 | - else unlink ($file); |
|
96 | + else unlink($file); |
|
97 | 97 | |
98 | - rmdir ($path); |
|
98 | + rmdir($path); |
|
99 | 99 | |
100 | 100 | return true; |
101 | 101 | } |
102 | 102 | |
103 | -function dir_clean (string $path): void |
|
103 | +function dir_clean(string $path): void |
|
104 | 104 | { |
105 | - dir_delete ($path); |
|
106 | - dir_create ($path); |
|
105 | + dir_delete($path); |
|
106 | + dir_create($path); |
|
107 | 107 | } |
108 | 108 | |
109 | -function dir_copy (string $from, string $to): bool |
|
109 | +function dir_copy(string $from, string $to): bool |
|
110 | 110 | { |
111 | - if (!is_dir ($from)) |
|
111 | + if (!is_dir($from)) |
|
112 | 112 | return false; |
113 | 113 | |
114 | - if (!is_dir ($to)) |
|
115 | - dir_create ($to); |
|
114 | + if (!is_dir($to)) |
|
115 | + dir_create($to); |
|
116 | 116 | |
117 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
118 | - if (is_dir ($f = $from .'/'. $file)) |
|
119 | - dir_copy ($f, $to .'/'. $file); |
|
117 | + foreach (array_slice(scandir($from), 2) as $file) |
|
118 | + if (is_dir($f = $from.'/'.$file)) |
|
119 | + dir_copy($f, $to.'/'.$file); |
|
120 | 120 | |
121 | - else copy ($f, $to .'/'. $file); |
|
121 | + else copy($f, $to.'/'.$file); |
|
122 | 122 | |
123 | 123 | return true; |
124 | 124 | } |
125 | 125 | |
126 | -function getARGBColor (string $color) |
|
126 | +function getARGBColor(string $color) |
|
127 | 127 | { |
128 | - return (new WFClass ('System.Drawing.ColorTranslator'))->fromHtml ($color); |
|
128 | + return (new WFClass('System.Drawing.ColorTranslator'))->fromHtml($color); |
|
129 | 129 | } |
130 | 130 | |
131 | -function replaceSl (string $string): string |
|
131 | +function replaceSl(string $string): string |
|
132 | 132 | { |
133 | - return str_replace ('\\', '/', $string); |
|
133 | + return str_replace('\\', '/', $string); |
|
134 | 134 | } |
135 | 135 | |
136 | -function replaceSr (string $string): string |
|
136 | +function replaceSr(string $string): string |
|
137 | 137 | { |
138 | - return str_replace ('/', '\\', $string); |
|
138 | + return str_replace('/', '\\', $string); |
|
139 | 139 | } |
140 | 140 | |
141 | -function basenameNoExt (string $path): string |
|
141 | +function basenameNoExt(string $path): string |
|
142 | 142 | { |
143 | - return pathinfo ($path, PATHINFO_FILENAME); |
|
143 | + return pathinfo($path, PATHINFO_FILENAME); |
|
144 | 144 | } |
145 | 145 | |
146 | -function file_ext (string $path): string |
|
146 | +function file_ext(string $path): string |
|
147 | 147 | { |
148 | - return strtolower (pathinfo ($path, PATHINFO_EXTENSION)); |
|
148 | + return strtolower(pathinfo($path, PATHINFO_EXTENSION)); |
|
149 | 149 | } |
150 | 150 | |
151 | -function filepathNoExt (string $path): string |
|
151 | +function filepathNoExt(string $path): string |
|
152 | 152 | { |
153 | - return dirname ($path) .'/'. basenameNoExt ($path); |
|
153 | + return dirname($path).'/'.basenameNoExt($path); |
|
154 | 154 | } |
155 | 155 | |
156 | -function array_first (array $array) |
|
156 | +function array_first(array $array) |
|
157 | 157 | { |
158 | - return array_shift ($array); |
|
158 | + return array_shift($array); |
|
159 | 159 | } |
160 | 160 | |
161 | -function array_end (array $array) |
|
161 | +function array_end(array $array) |
|
162 | 162 | { |
163 | - return array_pop ($array); |
|
163 | + return array_pop($array); |
|
164 | 164 | } |
165 | 165 | |
166 | -function substr_icount (string $haystack, string $needle, ...$params): int |
|
166 | +function substr_icount(string $haystack, string $needle, ...$params): int |
|
167 | 167 | { |
168 | - return substr_count (strtolower ($haystack), strtolower ($needle), ...$params); |
|
168 | + return substr_count(strtolower($haystack), strtolower($needle), ...$params); |
|
169 | 169 | } |
170 | 170 | |
171 | -function str_replace_assoc (string $subject, array $replacements): string |
|
171 | +function str_replace_assoc(string $subject, array $replacements): string |
|
172 | 172 | { |
173 | - return str_replace (array_keys ($replacements), array_values ($replacements), $subject); |
|
173 | + return str_replace(array_keys($replacements), array_values($replacements), $subject); |
|
174 | 174 | } |
175 | 175 | |
176 | -function pre (...$args): void |
|
176 | +function pre(...$args): void |
|
177 | 177 | { |
178 | - message (sizeof ($args) < 2 ? current ($args) : $args); |
|
178 | + message(sizeof($args) < 2 ? current ($args) : $args); |
|
179 | 179 | } |
180 | 180 | |
181 | -function messageBox (string $message, string $caption = '', ...$args) |
|
181 | +function messageBox(string $message, string $caption = '', ...$args) |
|
182 | 182 | { |
183 | - return (new MessageBox)->show ($message, $caption, ...$args); |
|
183 | + return (new MessageBox)->show($message, $caption, ...$args); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | class Components |
187 | 187 | { |
188 | 188 | static $components = []; |
189 | 189 | |
190 | - public static function addComponent (int $selector, object $object): void |
|
190 | + public static function addComponent(int $selector, object $object): void |
|
191 | 191 | { |
192 | 192 | self::$components[$selector] = $object; |
193 | 193 | } |
194 | 194 | |
195 | - public static function getComponent (int $selector) |
|
195 | + public static function getComponent(int $selector) |
|
196 | 196 | { |
197 | 197 | return isset (self::$components[$selector]) ? |
198 | 198 | self::$components[$selector] : false; |
199 | 199 | } |
200 | 200 | |
201 | - public static function componentExists (int $selector): bool |
|
201 | + public static function componentExists(int $selector): bool |
|
202 | 202 | { |
203 | 203 | return isset (self::$components[$selector]); |
204 | 204 | } |
205 | 205 | |
206 | - public static function removeComponent (int $selector): void |
|
206 | + public static function removeComponent(int $selector): void |
|
207 | 207 | { |
208 | 208 | unset (self::$components[$selector]); |
209 | 209 | } |
210 | 210 | |
211 | - public static function cleanJunk (): void |
|
211 | + public static function cleanJunk(): void |
|
212 | 212 | { |
213 | 213 | // TODO: более строгие правила очистки мусорных объектов |
214 | 214 | |
@@ -216,46 +216,46 @@ discard block |
||
216 | 216 | { |
217 | 217 | try |
218 | 218 | { |
219 | - if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) |
|
219 | + if ($object->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms'))) |
|
220 | 220 | continue; |
221 | 221 | } |
222 | 222 | |
223 | 223 | catch (\Exception $e) {} |
224 | 224 | |
225 | - VoidEngine::destructObject ($selector); |
|
225 | + VoidEngine::destructObject($selector); |
|
226 | 226 | |
227 | - if (!VoidEngine::objectExists ($selector)) |
|
227 | + if (!VoidEngine::objectExists($selector)) |
|
228 | 228 | unset (self::$components[$selector]); |
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | -function _c (int $selector) |
|
233 | +function _c(int $selector) |
|
234 | 234 | { |
235 | - return Components::getComponent ($selector); |
|
235 | + return Components::getComponent($selector); |
|
236 | 236 | } |
237 | 237 | |
238 | -function c ($name, bool $returnAllSimilarObjects = false) |
|
238 | +function c($name, bool $returnAllSimilarObjects = false) |
|
239 | 239 | { |
240 | - if (is_int ($name) && is_object ($object = _c ($name))) |
|
240 | + if (is_int($name) && is_object($object = _c($name))) |
|
241 | 241 | return $object; |
242 | 242 | |
243 | 243 | else |
244 | 244 | { |
245 | - $path = explode ('->', $name); |
|
245 | + $path = explode('->', $name); |
|
246 | 246 | $similar = []; |
247 | 247 | |
248 | 248 | foreach (Components::$components as $object) |
249 | 249 | try |
250 | 250 | { |
251 | - if ($object->name == end ($path)) |
|
251 | + if ($object->name == end($path)) |
|
252 | 252 | { |
253 | - if (sizeof ($path) > 1) |
|
253 | + if (sizeof($path) > 1) |
|
254 | 254 | try |
255 | 255 | { |
256 | - if (is_object ($parent = _c($object->parent->selector))) |
|
256 | + if (is_object($parent = _c($object->parent->selector))) |
|
257 | 257 | { |
258 | - if (c(join ('->', array_slice ($path, 0, -1))) == $parent) |
|
258 | + if (c(join('->', array_slice($path, 0, -1))) == $parent) |
|
259 | 259 | { |
260 | 260 | if ($returnAllSimilarObjects) |
261 | 261 | $similar[] = $object; |
@@ -289,18 +289,18 @@ discard block |
||
289 | 289 | continue; |
290 | 290 | } |
291 | 291 | |
292 | - if (sizeof ($path) == 2) |
|
292 | + if (sizeof($path) == 2) |
|
293 | 293 | { |
294 | 294 | $objects = c($path[1], true); |
295 | 295 | |
296 | - if (is_array ($objects)) |
|
296 | + if (is_array($objects)) |
|
297 | 297 | { |
298 | 298 | foreach ($objects as $id => $object) |
299 | 299 | try |
300 | 300 | { |
301 | - while (is_object ($parent = _c($object->parent->selector))) |
|
301 | + while (is_object($parent = _c($object->parent->selector))) |
|
302 | 302 | { |
303 | - if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0]) |
|
303 | + if ($parent->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0]) |
|
304 | 304 | return $objects[$id]; |
305 | 305 | |
306 | 306 | else $object = $parent; |
@@ -318,70 +318,70 @@ discard block |
||
318 | 318 | else return false; |
319 | 319 | } |
320 | 320 | |
321 | - else return $returnAllSimilarObjects && sizeof ($similar) > 0 ? |
|
321 | + else return $returnAllSimilarObjects && sizeof($similar) > 0 ? |
|
322 | 322 | $similar : false; |
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
326 | -function setTimer (int $interval, callable $function): Timer |
|
326 | +function setTimer(int $interval, callable $function): Timer |
|
327 | 327 | { |
328 | 328 | $timer = new Timer; |
329 | 329 | $timer->interval = $interval; |
330 | 330 | |
331 | - $timer->tickEvent = function ($self) use ($function) |
|
331 | + $timer->tickEvent = function($self) use ($function) |
|
332 | 332 | { |
333 | - call_user_func ($function, $self); |
|
333 | + call_user_func($function, $self); |
|
334 | 334 | }; |
335 | 335 | |
336 | - $timer->start (); |
|
336 | + $timer->start(); |
|
337 | 337 | |
338 | 338 | return $timer; |
339 | 339 | } |
340 | 340 | |
341 | 341 | // FIXME: выполняется несколько раз, а не единожды |
342 | -function setTimeout (int $timeout, callable $function): Timer |
|
342 | +function setTimeout(int $timeout, callable $function): Timer |
|
343 | 343 | { |
344 | 344 | $timer = new Timer; |
345 | 345 | $timer->interval = $timeout; |
346 | 346 | |
347 | - $timer->tickEvent = function ($self) use ($function) |
|
347 | + $timer->tickEvent = function($self) use ($function) |
|
348 | 348 | { |
349 | - call_user_func ($function, $self); |
|
349 | + call_user_func($function, $self); |
|
350 | 350 | |
351 | - $self->stop (); |
|
351 | + $self->stop(); |
|
352 | 352 | }; |
353 | 353 | |
354 | - $timer->start (); |
|
354 | + $timer->start(); |
|
355 | 355 | |
356 | 356 | return $timer; |
357 | 357 | } |
358 | 358 | |
359 | 359 | class Clipboard |
360 | 360 | { |
361 | - public static function getText () |
|
361 | + public static function getText() |
|
362 | 362 | { |
363 | - return (new WFClass ('System.Windows.Forms.Clipboard'))->getText (); |
|
363 | + return (new WFClass('System.Windows.Forms.Clipboard'))->getText(); |
|
364 | 364 | } |
365 | 365 | |
366 | - public static function setText (string $text): void |
|
366 | + public static function setText(string $text): void |
|
367 | 367 | { |
368 | - (new WFClass ('System.Windows.Forms.Clipboard'))->setText ($text); |
|
368 | + (new WFClass('System.Windows.Forms.Clipboard'))->setText($text); |
|
369 | 369 | } |
370 | 370 | |
371 | - public static function getFiles (): array |
|
371 | + public static function getFiles(): array |
|
372 | 372 | { |
373 | - return (new WFClass ('System.Windows.Forms.Clipboard'))->getFileDropList ()->list; |
|
373 | + return (new WFClass('System.Windows.Forms.Clipboard'))->getFileDropList()->list; |
|
374 | 374 | } |
375 | 375 | |
376 | - public static function setFiles (array $files): void |
|
376 | + public static function setFiles(array $files): void |
|
377 | 377 | { |
378 | - $collection = new WFObject ('System.Collections.Specialized.StringCollection'); |
|
378 | + $collection = new WFObject('System.Collections.Specialized.StringCollection'); |
|
379 | 379 | |
380 | 380 | foreach ($files as $file) |
381 | - $collection->add ((string) $file); |
|
381 | + $collection->add((string) $file); |
|
382 | 382 | |
383 | - (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection); |
|
384 | - VoidEngine::removeObjects ($collection->selector); |
|
383 | + (new WFClass('System.Windows.Forms.Clipboard'))->setFileDropList($collection); |
|
384 | + VoidEngine::removeObjects($collection->selector); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
@@ -389,14 +389,13 @@ discard block |
||
389 | 389 | { |
390 | 390 | protected $cursor; |
391 | 391 | |
392 | - public function __construct (int $handle = null) |
|
392 | + public function __construct(int $handle = null) |
|
393 | 393 | { |
394 | 394 | $handle !== null ? |
395 | - $this->cursor = new WFObject ('System.Windows.Forms.Cursor', 'auto', $handle) : |
|
396 | - $this->cursor = new WFClass ('System.Windows.Forms.Cursor'); |
|
395 | + $this->cursor = new WFObject('System.Windows.Forms.Cursor', 'auto', $handle) : $this->cursor = new WFClass('System.Windows.Forms.Cursor'); |
|
397 | 396 | } |
398 | 397 | |
399 | - public function getPosition (): array |
|
398 | + public function getPosition(): array |
|
400 | 399 | { |
401 | 400 | $pos = $this->cursor->position; |
402 | 401 | |
@@ -407,22 +406,22 @@ discard block |
||
407 | 406 | } |
408 | 407 | } |
409 | 408 | |
410 | -function get_cursor_x (int $handle = null): int |
|
409 | +function get_cursor_x(int $handle = null): int |
|
411 | 410 | { |
412 | - return (new Cursor ($handle))->getPosition ()[0]; |
|
411 | + return (new Cursor($handle))->getPosition()[0]; |
|
413 | 412 | } |
414 | 413 | |
415 | -function get_cursor_y (int $handle = null): int |
|
414 | +function get_cursor_y(int $handle = null): int |
|
416 | 415 | { |
417 | - return (new Cursor ($handle))->getPosition ()[1]; |
|
416 | + return (new Cursor($handle))->getPosition()[1]; |
|
418 | 417 | } |
419 | 418 | |
420 | -function get_cursor_pos (int $handle = null): array |
|
419 | +function get_cursor_pos(int $handle = null): array |
|
421 | 420 | { |
422 | - return (new Cursor ($handle))->getPosition (); |
|
421 | + return (new Cursor($handle))->getPosition(); |
|
423 | 422 | } |
424 | 423 | |
425 | -set_error_handler (function ($no, $str, $file, $line) |
|
424 | +set_error_handler(function($no, $str, $file, $line) |
|
426 | 425 | { |
427 | 426 | // Мог ли я здесь сделать более адекватный код с использованием pow/sqrt? Да, мог |
428 | 427 | // Почему не сделал? Скорость важнее |
@@ -445,11 +444,11 @@ discard block |
||
445 | 444 | ]; |
446 | 445 | |
447 | 446 | if ($GLOBALS['error_status']) |
448 | - message ([ |
|
447 | + message([ |
|
449 | 448 | 'type' => $errarr[$no], |
450 | 449 | 'text' => $str, |
451 | 450 | 'file' => $file, |
452 | 451 | 'line' => $line, |
453 | - 'backtrace' => debug_backtrace () |
|
452 | + 'backtrace' => debug_backtrace() |
|
454 | 453 | ], 'PHP Script Error'); |
455 | 454 | }); |
@@ -6,8 +6,9 @@ discard block |
||
6 | 6 | { |
7 | 7 | $oldStatus = $GLOBALS['error_status']; |
8 | 8 | |
9 | - if ($status !== null) |
|
10 | - $GLOBALS['error_status'] = $status; |
|
9 | + if ($status !== null) { |
|
10 | + $GLOBALS['error_status'] = $status; |
|
11 | + } |
|
11 | 12 | |
12 | 13 | return $oldStatus; |
13 | 14 | } |
@@ -41,9 +42,7 @@ discard block |
||
41 | 42 | try |
42 | 43 | { |
43 | 44 | eval ('return; '. $code); |
44 | - } |
|
45 | - |
|
46 | - catch (\Throwable $e) |
|
45 | + } catch (\Throwable $e) |
|
47 | 46 | { |
48 | 47 | return [ |
49 | 48 | 'text' => $e->getMessage (), |
@@ -67,34 +66,39 @@ discard block |
||
67 | 66 | $array = (new WFClass ('System.Array', null)) |
68 | 67 | ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items)); |
69 | 68 | |
70 | - for ($i = 0; $i < $size; ++$i) |
|
71 | - $array[$i] = array_shift ($items); |
|
69 | + for ($i = 0; $i < $size; ++$i) { |
|
70 | + $array[$i] = array_shift ($items); |
|
71 | + } |
|
72 | 72 | |
73 | 73 | return $array; |
74 | 74 | } |
75 | 75 | |
76 | 76 | function dir_create (string $path, int $mode = 0777): void |
77 | 77 | { |
78 | - if (!is_dir ($path)) |
|
79 | - mkdir ($path, $mode, true); |
|
80 | -} |
|
78 | + if (!is_dir ($path)) { |
|
79 | + mkdir ($path, $mode, true); |
|
80 | + } |
|
81 | + } |
|
81 | 82 | |
82 | 83 | function dir_delete (string $path): bool |
83 | 84 | { |
84 | - if (!is_dir ($path)) |
|
85 | - return false; |
|
85 | + if (!is_dir ($path)) { |
|
86 | + return false; |
|
87 | + } |
|
86 | 88 | |
87 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
88 | - if (is_dir ($file = $path .'/'. $file)) |
|
89 | + foreach (array_slice (scandir ($path), 2) as $file) { |
|
90 | + if (is_dir ($file = $path .'/'. $file)) |
|
89 | 91 | { |
90 | 92 | dir_delete ($file); |
93 | + } |
|
91 | 94 | |
92 | - if (is_dir ($file)) |
|
93 | - rmdir ($file); |
|
95 | + if (is_dir ($file)) { |
|
96 | + rmdir ($file); |
|
97 | + } |
|
98 | + } else { |
|
99 | + unlink ($file); |
|
94 | 100 | } |
95 | 101 | |
96 | - else unlink ($file); |
|
97 | - |
|
98 | 102 | rmdir ($path); |
99 | 103 | |
100 | 104 | return true; |
@@ -108,17 +112,22 @@ discard block |
||
108 | 112 | |
109 | 113 | function dir_copy (string $from, string $to): bool |
110 | 114 | { |
111 | - if (!is_dir ($from)) |
|
112 | - return false; |
|
115 | + if (!is_dir ($from)) { |
|
116 | + return false; |
|
117 | + } |
|
113 | 118 | |
114 | - if (!is_dir ($to)) |
|
115 | - dir_create ($to); |
|
119 | + if (!is_dir ($to)) { |
|
120 | + dir_create ($to); |
|
121 | + } |
|
116 | 122 | |
117 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
118 | - if (is_dir ($f = $from .'/'. $file)) |
|
123 | + foreach (array_slice (scandir ($from), 2) as $file) { |
|
124 | + if (is_dir ($f = $from .'/'. $file)) |
|
119 | 125 | dir_copy ($f, $to .'/'. $file); |
126 | + } |
|
120 | 127 | |
121 | - else copy ($f, $to .'/'. $file); |
|
128 | + else { |
|
129 | + copy ($f, $to .'/'. $file); |
|
130 | + } |
|
122 | 131 | |
123 | 132 | return true; |
124 | 133 | } |
@@ -216,16 +225,16 @@ discard block |
||
216 | 225 | { |
217 | 226 | try |
218 | 227 | { |
219 | - if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) |
|
220 | - continue; |
|
221 | - } |
|
222 | - |
|
223 | - catch (\Exception $e) {} |
|
228 | + if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) { |
|
229 | + continue; |
|
230 | + } |
|
231 | + } catch (\Exception $e) {} |
|
224 | 232 | |
225 | 233 | VoidEngine::destructObject ($selector); |
226 | 234 | |
227 | - if (!VoidEngine::objectExists ($selector)) |
|
228 | - unset (self::$components[$selector]); |
|
235 | + if (!VoidEngine::objectExists ($selector)) { |
|
236 | + unset (self::$components[$selector]); |
|
237 | + } |
|
229 | 238 | } |
230 | 239 | } |
231 | 240 | } |
@@ -237,16 +246,15 @@ discard block |
||
237 | 246 | |
238 | 247 | function c ($name, bool $returnAllSimilarObjects = false) |
239 | 248 | { |
240 | - if (is_int ($name) && is_object ($object = _c ($name))) |
|
241 | - return $object; |
|
242 | - |
|
243 | - else |
|
249 | + if (is_int ($name) && is_object ($object = _c ($name))) { |
|
250 | + return $object; |
|
251 | + } else |
|
244 | 252 | { |
245 | 253 | $path = explode ('->', $name); |
246 | 254 | $similar = []; |
247 | 255 | |
248 | - foreach (Components::$components as $object) |
|
249 | - try |
|
256 | + foreach (Components::$components as $object) { |
|
257 | + try |
|
250 | 258 | { |
251 | 259 | if ($object->name == end ($path)) |
252 | 260 | { |
@@ -259,32 +267,30 @@ discard block |
||
259 | 267 | { |
260 | 268 | if ($returnAllSimilarObjects) |
261 | 269 | $similar[] = $object; |
270 | + } |
|
262 | 271 | |
263 | - else return $object; |
|
272 | + else { |
|
273 | + return $object; |
|
274 | + } |
|
275 | + } else { |
|
276 | + continue; |
|
264 | 277 | } |
265 | - |
|
266 | - else continue; |
|
278 | + } else { |
|
279 | + continue; |
|
267 | 280 | } |
268 | - |
|
269 | - else continue; |
|
270 | - } |
|
271 | - |
|
272 | - catch (\Throwable $e) |
|
281 | + } catch (\Throwable $e) |
|
273 | 282 | { |
274 | 283 | continue; |
275 | - } |
|
276 | - |
|
277 | - else |
|
284 | + } else |
|
278 | 285 | { |
279 | - if ($returnAllSimilarObjects) |
|
280 | - $similar[] = $object; |
|
281 | - |
|
282 | - else return $object; |
|
286 | + if ($returnAllSimilarObjects) { |
|
287 | + $similar[] = $object; |
|
288 | + } else { |
|
289 | + return $object; |
|
290 | + } |
|
283 | 291 | } |
284 | 292 | } |
285 | - } |
|
286 | - |
|
287 | - catch (\Exception $e) |
|
293 | + } catch (\Exception $e) |
|
288 | 294 | { |
289 | 295 | continue; |
290 | 296 | } |
@@ -295,31 +301,32 @@ discard block |
||
295 | 301 | |
296 | 302 | if (is_array ($objects)) |
297 | 303 | { |
298 | - foreach ($objects as $id => $object) |
|
299 | - try |
|
304 | + foreach ($objects as $id => $object) { |
|
305 | + try |
|
300 | 306 | { |
301 | 307 | while (is_object ($parent = _c($object->parent->selector))) |
302 | 308 | { |
303 | 309 | if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0]) |
304 | 310 | return $objects[$id]; |
311 | + } |
|
305 | 312 | |
306 | - else $object = $parent; |
|
313 | + else { |
|
314 | + $object = $parent; |
|
315 | + } |
|
307 | 316 | } |
308 | - } |
|
309 | - |
|
310 | - catch (\Throwable $e) |
|
317 | + } catch (\Throwable $e) |
|
311 | 318 | { |
312 | 319 | continue; |
313 | 320 | } |
314 | 321 | |
315 | 322 | return false; |
323 | + } else { |
|
324 | + return false; |
|
316 | 325 | } |
317 | - |
|
318 | - else return false; |
|
319 | - } |
|
320 | - |
|
321 | - else return $returnAllSimilarObjects && sizeof ($similar) > 0 ? |
|
326 | + } else { |
|
327 | + return $returnAllSimilarObjects && sizeof ($similar) > 0 ? |
|
322 | 328 | $similar : false; |
329 | + } |
|
323 | 330 | } |
324 | 331 | } |
325 | 332 | |
@@ -377,8 +384,9 @@ discard block |
||
377 | 384 | { |
378 | 385 | $collection = new WFObject ('System.Collections.Specialized.StringCollection'); |
379 | 386 | |
380 | - foreach ($files as $file) |
|
381 | - $collection->add ((string) $file); |
|
387 | + foreach ($files as $file) { |
|
388 | + $collection->add ((string) $file); |
|
389 | + } |
|
382 | 390 | |
383 | 391 | (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection); |
384 | 392 | VoidEngine::removeObjects ($collection->selector); |
@@ -444,12 +452,13 @@ discard block |
||
444 | 452 | 16384 => 'E_USER_DEPRECATED' |
445 | 453 | ]; |
446 | 454 | |
447 | - if ($GLOBALS['error_status']) |
|
448 | - message ([ |
|
455 | + if ($GLOBALS['error_status']) { |
|
456 | + message ([ |
|
449 | 457 | 'type' => $errarr[$no], |
450 | 458 | 'text' => $str, |
451 | 459 | 'file' => $file, |
452 | 460 | 'line' => $line, |
453 | 461 | 'backtrace' => debug_backtrace () |
454 | 462 | ], 'PHP Script Error'); |
455 | -}); |
|
463 | + } |
|
464 | + }); |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | - * * Создание экземпляра типа объекта |
|
112 | - * |
|
113 | - * @param mixed $objectName - полное название объекта |
|
114 | - * [@param mixed $objectGroup = null] - полное пространство имён объекта |
|
115 | - * |
|
116 | - * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки |
|
117 | - * |
|
118 | - */ |
|
111 | + * * Создание экземпляра типа объекта |
|
112 | + * |
|
113 | + * @param mixed $objectName - полное название объекта |
|
114 | + * [@param mixed $objectGroup = null] - полное пространство имён объекта |
|
115 | + * |
|
116 | + * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки |
|
117 | + * |
|
118 | + */ |
|
119 | 119 | |
120 | 120 | public static function objectType ($objectName, $objectGroup = null) |
121 | 121 | { |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | } |
551 | 551 | |
552 | 552 | public function __get ($name) |
553 | - { |
|
553 | + { |
|
554 | 554 | if (method_exists ($this, $method = "get_$name")) |
555 | 555 | $value = $this->$method (); |
556 | 556 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | $size = $this->count; |
580 | 580 | $list = []; |
581 | 581 | |
582 | - for ($i = 0; $i < $size; ++$i) |
|
582 | + for ($i = 0; $i < $size; ++$i) |
|
583 | 583 | $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i)); |
584 | 584 | |
585 | 585 | return $list; |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | } |
610 | 610 | |
611 | 611 | return EngineAdditions::coupleSelector ($value, $this->selector); |
612 | - } |
|
612 | + } |
|
613 | 613 | |
614 | - public function __set ($name, $value) |
|
615 | - { |
|
614 | + public function __set ($name, $value) |
|
615 | + { |
|
616 | 616 | if (method_exists ($this, $method = "set_$name")) |
617 | 617 | try |
618 | 618 | { |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
635 | 635 | } |
636 | 636 | |
637 | - public function __call ($method, $args) |
|
638 | - { |
|
637 | + public function __call ($method, $args) |
|
638 | + { |
|
639 | 639 | $args = array_map (function ($arg) |
640 | 640 | { |
641 | 641 | return EngineAdditions::uncoupleSelector ($arg); |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | } |
652 | 652 | |
653 | 653 | public function offsetSet ($index, $value) |
654 | - { |
|
654 | + { |
|
655 | 655 | try |
656 | 656 | { |
657 | 657 | return $index === null ? |
@@ -667,14 +667,14 @@ discard block |
||
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | - public function offsetGet ($index) |
|
671 | - { |
|
672 | - return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector); |
|
670 | + public function offsetGet ($index) |
|
671 | + { |
|
672 | + return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector); |
|
673 | 673 | } |
674 | 674 | |
675 | - public function offsetUnset ($index): void |
|
676 | - { |
|
677 | - $this->callMethod ('RemoveAt', $index); |
|
675 | + public function offsetUnset ($index): void |
|
676 | + { |
|
677 | + $this->callMethod ('RemoveAt', $index); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | public function offsetExists ($index): bool |
@@ -692,19 +692,19 @@ discard block |
||
692 | 692 | return true; |
693 | 693 | } |
694 | 694 | |
695 | - public function indexOf ($value): int |
|
696 | - { |
|
697 | - return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
695 | + public function indexOf ($value): int |
|
696 | + { |
|
697 | + return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | public function lastIndexOf ($value): int |
701 | - { |
|
702 | - return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
703 | - } |
|
701 | + { |
|
702 | + return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
703 | + } |
|
704 | 704 | |
705 | - public function contains ($value): bool |
|
706 | - { |
|
707 | - return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value)); |
|
705 | + public function contains ($value): bool |
|
706 | + { |
|
707 | + return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value)); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | public function foreach (callable $callback, string $type = null): void |
@@ -758,45 +758,45 @@ discard block |
||
758 | 758 | return VoidEngine::callMethod ($this->selector, $method, ...$args); |
759 | 759 | } |
760 | 760 | |
761 | - protected function getArrayProperty ($name, string $type = null) |
|
762 | - { |
|
761 | + protected function getArrayProperty ($name, string $type = null) |
|
762 | + { |
|
763 | 763 | $array = $this->getProperty ($name); |
764 | 764 | $size = VoidEngine::getProperty ($array, 'Length'); |
765 | 765 | $return = []; |
766 | 766 | |
767 | - for ($i = 0; $i < $size; ++$i) |
|
767 | + for ($i = 0; $i < $size; ++$i) |
|
768 | 768 | $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]); |
769 | 769 | |
770 | 770 | VoidEngine::removeObjects ($array); |
771 | 771 | |
772 | - return $return; |
|
772 | + return $return; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | public function get_name () |
776 | - { |
|
777 | - try |
|
778 | - { |
|
779 | - return $this->getProperty ('Name'); |
|
776 | + { |
|
777 | + try |
|
778 | + { |
|
779 | + return $this->getProperty ('Name'); |
|
780 | 780 | } |
781 | 781 | |
782 | - catch (\Throwable $e) |
|
783 | - { |
|
784 | - return $this->name; |
|
785 | - } |
|
786 | - } |
|
782 | + catch (\Throwable $e) |
|
783 | + { |
|
784 | + return $this->name; |
|
785 | + } |
|
786 | + } |
|
787 | 787 | |
788 | - public function set_name (string $name) |
|
789 | - { |
|
790 | - try |
|
791 | - { |
|
792 | - $this->setProperty ('Name', $name); |
|
788 | + public function set_name (string $name) |
|
789 | + { |
|
790 | + try |
|
791 | + { |
|
792 | + $this->setProperty ('Name', $name); |
|
793 | 793 | } |
794 | 794 | |
795 | - catch (\Throwable $e) |
|
796 | - { |
|
797 | - $this->name = $name; |
|
798 | - } |
|
799 | - } |
|
795 | + catch (\Throwable $e) |
|
796 | + { |
|
797 | + $this->name = $name; |
|
798 | + } |
|
799 | + } |
|
800 | 800 | |
801 | 801 | public function __toString (): string |
802 | 802 | { |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | * |
18 | 18 | */ |
19 | 19 | |
20 | - public static function createObject ($objectName, $objectGroup = null, ...$args): int |
|
20 | + public static function createObject($objectName, $objectGroup = null, ...$args): int |
|
21 | 21 | { |
22 | - return \VoidCore::createObject ($objectName, $objectGroup, ...$args); |
|
22 | + return \VoidCore::createObject($objectName, $objectGroup, ...$args); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * |
35 | 35 | */ |
36 | 36 | |
37 | - public static function removeObjects (int ...$selectors): void |
|
37 | + public static function removeObjects(int ...$selectors): void |
|
38 | 38 | { |
39 | - \VoidCore::removeObjects (...$selectors); |
|
39 | + \VoidCore::removeObjects(...$selectors); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * |
52 | 52 | */ |
53 | 53 | |
54 | - public static function destructObject (int $selector): bool |
|
54 | + public static function destructObject(int $selector): bool |
|
55 | 55 | { |
56 | - return \VoidCore::destructObject ($selector); |
|
56 | + return \VoidCore::destructObject($selector); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * |
69 | 69 | */ |
70 | 70 | |
71 | - public static function createClass ($className, $classGroup = null): int |
|
71 | + public static function createClass($className, $classGroup = null): int |
|
72 | 72 | { |
73 | - return \VoidCore::getClass ($className, $classGroup); |
|
73 | + return \VoidCore::getClass($className, $classGroup); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * |
84 | 84 | */ |
85 | 85 | |
86 | - public static function createDelegate (string $type, string $code): int |
|
86 | + public static function createDelegate(string $type, string $code): int |
|
87 | 87 | { |
88 | - return \VoidCore::createDelegate ($type, $code); |
|
88 | + return \VoidCore::createDelegate($type, $code); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * |
103 | 103 | */ |
104 | 104 | |
105 | - public static function objectExists (int $selector): bool |
|
105 | + public static function objectExists(int $selector): bool |
|
106 | 106 | { |
107 | - return \VoidCore::objectExists ($selector); |
|
107 | + return \VoidCore::objectExists($selector); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * |
118 | 118 | */ |
119 | 119 | |
120 | - public static function objectType ($objectName, $objectGroup = null) |
|
120 | + public static function objectType($objectName, $objectGroup = null) |
|
121 | 121 | { |
122 | - return \VoidCore::typeof ($objectName, $objectGroup); |
|
122 | + return \VoidCore::typeof($objectName, $objectGroup); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * |
141 | 141 | */ |
142 | 142 | |
143 | - public static function getProperty (int $selector, $propertyName) |
|
143 | + public static function getProperty(int $selector, $propertyName) |
|
144 | 144 | { |
145 | - return \VoidCore::getProp ($selector, $propertyName); |
|
145 | + return \VoidCore::getProp($selector, $propertyName); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * |
163 | 163 | */ |
164 | 164 | |
165 | - public static function setProperty (int $selector, string $propertyName, $value): void |
|
165 | + public static function setProperty(int $selector, string $propertyName, $value): void |
|
166 | 166 | { |
167 | - \VoidCore::setProp ($selector, $propertyName, $value); |
|
167 | + \VoidCore::setProp($selector, $propertyName, $value); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | * |
185 | 185 | */ |
186 | 186 | |
187 | - public static function getField (int $selector, $fieldName) |
|
187 | + public static function getField(int $selector, $fieldName) |
|
188 | 188 | { |
189 | - return \VoidCore::getField ($selector, $fieldName); |
|
189 | + return \VoidCore::getField($selector, $fieldName); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * |
202 | 202 | */ |
203 | 203 | |
204 | - public static function setField (int $selector, string $fieldName, $value): void |
|
204 | + public static function setField(int $selector, string $fieldName, $value): void |
|
205 | 205 | { |
206 | - \VoidCore::setField ($selector, $fieldName, $value); |
|
206 | + \VoidCore::setField($selector, $fieldName, $value); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * |
228 | 228 | */ |
229 | 229 | |
230 | - public static function callMethod (int $selector, $methodName, ...$args) |
|
230 | + public static function callMethod(int $selector, $methodName, ...$args) |
|
231 | 231 | { |
232 | - return \VoidCore::callMethod ($selector, $methodName, ...$args); |
|
232 | + return \VoidCore::callMethod($selector, $methodName, ...$args); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | * |
246 | 246 | */ |
247 | 247 | |
248 | - public static function getArrayValue (int $selector, $index) |
|
248 | + public static function getArrayValue(int $selector, $index) |
|
249 | 249 | { |
250 | - return \VoidCore::getArrayValue ($selector, $index); |
|
250 | + return \VoidCore::getArrayValue($selector, $index); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | * |
266 | 266 | */ |
267 | 267 | |
268 | - public static function setArrayValue (int $selector, $index, $value): void |
|
268 | + public static function setArrayValue(int $selector, $index, $value): void |
|
269 | 269 | { |
270 | - \VoidCore::setArrayValue ($selector, $index, $value); |
|
270 | + \VoidCore::setArrayValue($selector, $index, $value); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | * |
283 | 283 | */ |
284 | 284 | |
285 | - public static function setObjectEvent (int $selector, string $eventName, callable $event): void |
|
285 | + public static function setObjectEvent(int $selector, string $eventName, callable $event): void |
|
286 | 286 | { |
287 | 287 | /*if (self::eventExists ($selector, $eventName)) |
288 | 288 | self::removeObjectEvent ($selector, $eventName);*/ |
289 | 289 | |
290 | - \VoidCore::setEvent ($selector, $eventName, $event); |
|
290 | + \VoidCore::setEvent($selector, $eventName, $event); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | * |
306 | 306 | */ |
307 | 307 | |
308 | - public static function eventExists (int $selector, string $eventName): bool |
|
308 | + public static function eventExists(int $selector, string $eventName): bool |
|
309 | 309 | { |
310 | - return \VoidCore::eventExists ($selector, $eventName); |
|
310 | + return \VoidCore::eventExists($selector, $eventName); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | * |
325 | 325 | */ |
326 | 326 | |
327 | - public static function removeObjectEvent (int $selector, string $eventName): void |
|
327 | + public static function removeObjectEvent(int $selector, string $eventName): void |
|
328 | 328 | { |
329 | - \VoidCore::removeEvent ($selector, $eventName); |
|
329 | + \VoidCore::removeEvent($selector, $eventName); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | * |
339 | 339 | */ |
340 | 340 | |
341 | - public static function importObject (string $data): int |
|
341 | + public static function importObject(string $data): int |
|
342 | 342 | { |
343 | - return \VoidCore::importObject ($data); |
|
343 | + return \VoidCore::importObject($data); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | * |
353 | 353 | */ |
354 | 354 | |
355 | - public static function exportObject (int $selector): string |
|
355 | + public static function exportObject(int $selector): string |
|
356 | 356 | { |
357 | - return \VoidCore::exportObject ($selector); |
|
357 | + return \VoidCore::exportObject($selector); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -378,20 +378,20 @@ discard block |
||
378 | 378 | * |
379 | 379 | */ |
380 | 380 | |
381 | - public static function compile (string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array |
|
381 | + public static function compile(string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array |
|
382 | 382 | { |
383 | 383 | if ($dictionary === null) |
384 | - $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null); |
|
384 | + $dictionary = new WFObject('System.Collections.Generic.Dictionary`2[System.String,System.String]', null); |
|
385 | 385 | |
386 | 386 | if ($assemblies === null) |
387 | - $assemblies = getNetArray ('System.String', [ |
|
387 | + $assemblies = getNetArray('System.String', [ |
|
388 | 388 | // CORE_DIR .'/CefSharp.dll', |
389 | - CORE_DIR .'/FastColoredTextBox.dll', |
|
390 | - CORE_DIR .'/ScintillaNET.dll' |
|
389 | + CORE_DIR.'/FastColoredTextBox.dll', |
|
390 | + CORE_DIR.'/ScintillaNET.dll' |
|
391 | 391 | ]); |
392 | 392 | |
393 | 393 | if ($productName === null) |
394 | - $productName = basenameNoExt ($savePath); |
|
394 | + $productName = basenameNoExt($savePath); |
|
395 | 395 | |
396 | 396 | if ($productDescription === null) |
397 | 397 | $productDescription = $productName; |
@@ -403,19 +403,19 @@ discard block |
||
403 | 403 | $companyName = 'Company N'; |
404 | 404 | |
405 | 405 | if ($copyright === null) |
406 | - $copyright = $companyName .' copyright (c) '. date ('Y'); |
|
406 | + $copyright = $companyName.' copyright (c) '.date('Y'); |
|
407 | 407 | |
408 | - return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names; |
|
408 | + return (new WFClass('WinForms_PHP.WFCompiler', null))->compile($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | 412 | class EngineAdditions |
413 | 413 | { |
414 | - public static function loadModule (string $path): bool |
|
414 | + public static function loadModule(string $path): bool |
|
415 | 415 | { |
416 | 416 | try |
417 | 417 | { |
418 | - (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path); |
|
418 | + (new WFClass('System.Reflection.Assembly', 'mscorlib'))->loadFrom($path); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | catch (\Throwable $e) |
@@ -426,16 +426,16 @@ discard block |
||
426 | 426 | return true; |
427 | 427 | } |
428 | 428 | |
429 | - public static function getProperty (int $selector, string $name): array |
|
429 | + public static function getProperty(int $selector, string $name): array |
|
430 | 430 | { |
431 | - $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name); |
|
431 | + $property = VoidEngine::callMethod(VoidEngine::callMethod($selector, 'GetType'), 'GetProperty', $name); |
|
432 | 432 | |
433 | - if (!is_int ($property)) |
|
433 | + if (!is_int($property)) |
|
434 | 434 | return false; |
435 | 435 | |
436 | 436 | try |
437 | 437 | { |
438 | - $propertyType = VoidEngine::getProperty ($property, ['PropertyType', 'string']); |
|
438 | + $propertyType = VoidEngine::getProperty($property, ['PropertyType', 'string']); |
|
439 | 439 | |
440 | 440 | switch ($propertyType) |
441 | 441 | { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | default: |
472 | 472 | try |
473 | 473 | { |
474 | - VoidEngine::getProperty ($selector, [$name, 'int']); |
|
474 | + VoidEngine::getProperty($selector, [$name, 'int']); |
|
475 | 475 | |
476 | 476 | $property = 'int'; |
477 | 477 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | { |
481 | 481 | return [ |
482 | 482 | 'type' => 'vrsf', |
483 | - 'value' => VoidEngine::exportObject (VoidEngine::getProperty ($selector, [$name, 'object'])) |
|
483 | + 'value' => VoidEngine::exportObject(VoidEngine::getProperty($selector, [$name, 'object'])) |
|
484 | 484 | ]; |
485 | 485 | } |
486 | 486 | break; |
@@ -494,19 +494,19 @@ discard block |
||
494 | 494 | |
495 | 495 | return [ |
496 | 496 | 'type' => $property, |
497 | - 'value' => VoidEngine::getProperty ($selector, [$name, $property]) |
|
497 | + 'value' => VoidEngine::getProperty($selector, [$name, $property]) |
|
498 | 498 | ]; |
499 | 499 | } |
500 | 500 | |
501 | - public static function getObjectEvents (int $object): array |
|
501 | + public static function getObjectEvents(int $object): array |
|
502 | 502 | { |
503 | 503 | $events = []; |
504 | 504 | |
505 | - $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents'); |
|
506 | - $len = VoidEngine::getProperty ($props, 'Length'); |
|
505 | + $props = VoidEngine::callMethod(VoidEngine::callMethod($object, 'GetType'), 'GetEvents'); |
|
506 | + $len = VoidEngine::getProperty($props, 'Length'); |
|
507 | 507 | |
508 | 508 | for ($i = 0; $i < $len; ++$i) |
509 | - $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name'); |
|
509 | + $events[] = VoidEngine::getProperty(VoidEngine::getArrayValue($props, $i), 'Name'); |
|
510 | 510 | |
511 | 511 | return $events; |
512 | 512 | } |
@@ -516,13 +516,13 @@ discard block |
||
516 | 516 | * Тогда получается бесконечный цикл вида object->selector->selector->selector->... |
517 | 517 | * Чтобы этого избежать нужно добавить исключение - переменную $selfSelector |
518 | 518 | */ |
519 | - public static function coupleSelector ($value, int $selfSelector = null) |
|
519 | + public static function coupleSelector($value, int $selfSelector = null) |
|
520 | 520 | { |
521 | - return is_int ($value) && VoidEngine::objectExists ($value) && $value != $selfSelector ? |
|
522 | - new WFObject ($value) : $value; |
|
521 | + return is_int($value) && VoidEngine::objectExists($value) && $value != $selfSelector ? |
|
522 | + new WFObject($value) : $value; |
|
523 | 523 | } |
524 | 524 | |
525 | - public static function uncoupleSelector ($value) |
|
525 | + public static function uncoupleSelector($value) |
|
526 | 526 | { |
527 | 527 | return $value instanceof WFObject ? |
528 | 528 | $value->selector : $value; |
@@ -534,44 +534,44 @@ discard block |
||
534 | 534 | protected $selector; |
535 | 535 | protected $name; |
536 | 536 | |
537 | - public function __construct ($object, ?string $classGroup = 'auto', ...$args) |
|
537 | + public function __construct($object, ?string $classGroup = 'auto', ...$args) |
|
538 | 538 | { |
539 | 539 | foreach ($args as $id => $arg) |
540 | - $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
540 | + $args[$id] = EngineAdditions::uncoupleSelector($arg); |
|
541 | 541 | |
542 | - if (is_string ($object)) |
|
543 | - $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ? |
|
544 | - substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args); |
|
542 | + if (is_string($object)) |
|
543 | + $this->selector = VoidEngine::createObject($object, $classGroup == 'auto' ? |
|
544 | + substr ($object, 0, strrpos($object, '.')) : $classGroup, ...$args); |
|
545 | 545 | |
546 | - elseif (is_int ($object) && VoidEngine::objectExists ($object)) |
|
546 | + elseif (is_int($object) && VoidEngine::objectExists($object)) |
|
547 | 547 | $this->selector = $object; |
548 | 548 | |
549 | - else throw new \Exception ('$object parameter must be string or object selector'); |
|
549 | + else throw new \Exception('$object parameter must be string or object selector'); |
|
550 | 550 | } |
551 | 551 | |
552 | - public function __get ($name) |
|
552 | + public function __get($name) |
|
553 | 553 | { |
554 | - if (method_exists ($this, $method = "get_$name")) |
|
555 | - $value = $this->$method (); |
|
554 | + if (method_exists($this, $method = "get_$name")) |
|
555 | + $value = $this->$method(); |
|
556 | 556 | |
557 | - elseif (substr ($name, -5) == 'Event') |
|
558 | - $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5)); |
|
557 | + elseif (substr($name, -5) == 'Event') |
|
558 | + $value = Events::getObjectEvent($this->selector, substr($name, 0, -5)); |
|
559 | 559 | |
560 | - elseif (property_exists ($this, $name)) |
|
560 | + elseif (property_exists($this, $name)) |
|
561 | 561 | $value = $this->$name; |
562 | 562 | |
563 | - else switch (strtolower ($name)) |
|
563 | + else switch (strtolower($name)) |
|
564 | 564 | { |
565 | 565 | case 'count': |
566 | 566 | case 'length': |
567 | 567 | try |
568 | 568 | { |
569 | - return $this->getProperty ('Count'); |
|
569 | + return $this->getProperty('Count'); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | catch (\Throwable $e) |
573 | 573 | { |
574 | - return $this->getProperty ('Length'); |
|
574 | + return $this->getProperty('Length'); |
|
575 | 575 | } |
576 | 576 | break; |
577 | 577 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $list = []; |
581 | 581 | |
582 | 582 | for ($i = 0; $i < $size; ++$i) |
583 | - $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i)); |
|
583 | + $list[] = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $i)); |
|
584 | 584 | |
585 | 585 | return $list; |
586 | 586 | break; |
@@ -592,31 +592,31 @@ discard block |
||
592 | 592 | for ($i = 0; $i < $size; ++$i) |
593 | 593 | try |
594 | 594 | { |
595 | - $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text'); |
|
595 | + $names[] = VoidEngine::getProperty(VoidEngine::getArrayValue($this->selector, [$i, 'object']), 'Text'); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | catch (\Throwable $e) |
599 | 599 | { |
600 | - $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']); |
|
600 | + $names[] = VoidEngine::getArrayValue($this->selector, [$i, 'string']); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | return $names; |
604 | 604 | break; |
605 | 605 | |
606 | 606 | default: |
607 | - $value = $this->getProperty ($name); |
|
607 | + $value = $this->getProperty($name); |
|
608 | 608 | break; |
609 | 609 | } |
610 | 610 | |
611 | - return EngineAdditions::coupleSelector ($value, $this->selector); |
|
611 | + return EngineAdditions::coupleSelector($value, $this->selector); |
|
612 | 612 | } |
613 | 613 | |
614 | - public function __set ($name, $value) |
|
614 | + public function __set($name, $value) |
|
615 | 615 | { |
616 | - if (method_exists ($this, $method = "set_$name")) |
|
616 | + if (method_exists($this, $method = "set_$name")) |
|
617 | 617 | try |
618 | 618 | { |
619 | - return $this->$method ($value); |
|
619 | + return $this->$method($value); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | # Метод "set_$name" может принимать в качестве параметра объект WFObject |
@@ -625,63 +625,61 @@ discard block |
||
625 | 625 | catch (\Throwable $e) |
626 | 626 | { |
627 | 627 | return $value instanceof WFObject ? |
628 | - $this->$method ($value->selector) : null; |
|
628 | + $this->$method($value->selector) : null; |
|
629 | 629 | } |
630 | 630 | |
631 | - elseif (substr ($name, -5) == 'Event') |
|
632 | - Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value); |
|
631 | + elseif (substr($name, -5) == 'Event') |
|
632 | + Events::setObjectEvent($this->selector, substr($name, 0, -5), $value); |
|
633 | 633 | |
634 | - else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
634 | + else $this->setProperty($name, EngineAdditions::uncoupleSelector($value)); |
|
635 | 635 | } |
636 | 636 | |
637 | - public function __call ($method, $args) |
|
637 | + public function __call($method, $args) |
|
638 | 638 | { |
639 | - $args = array_map (function ($arg) |
|
639 | + $args = array_map(function($arg) |
|
640 | 640 | { |
641 | - return EngineAdditions::uncoupleSelector ($arg); |
|
641 | + return EngineAdditions::uncoupleSelector($arg); |
|
642 | 642 | }, $args); |
643 | 643 | |
644 | - return EngineAdditions::coupleSelector ($this->callMethod ($method, ...$args), $this->selector); |
|
644 | + return EngineAdditions::coupleSelector($this->callMethod($method, ...$args), $this->selector); |
|
645 | 645 | } |
646 | 646 | |
647 | - public function addRange (array $values, $assoc = false): void |
|
647 | + public function addRange(array $values, $assoc = false): void |
|
648 | 648 | { |
649 | 649 | foreach ($values as $id => $value) |
650 | - $this->offsetSet ($assoc ? $id : null, $value); |
|
650 | + $this->offsetSet($assoc ? $id : null, $value); |
|
651 | 651 | } |
652 | 652 | |
653 | - public function offsetSet ($index, $value) |
|
653 | + public function offsetSet($index, $value) |
|
654 | 654 | { |
655 | 655 | try |
656 | 656 | { |
657 | 657 | return $index === null ? |
658 | - $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) : |
|
659 | - $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value)); |
|
658 | + $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value)); |
|
660 | 659 | } |
661 | 660 | |
662 | 661 | catch (\Throwable $e) |
663 | 662 | { |
664 | 663 | return $index === null ? |
665 | - VoidEngine::setArrayValue ($this->selector, $this->count, $value) : |
|
666 | - VoidEngine::setArrayValue ($this->selector, $index, $value); |
|
664 | + VoidEngine::setArrayValue($this->selector, $this->count, $value) : VoidEngine::setArrayValue($this->selector, $index, $value); |
|
667 | 665 | } |
668 | 666 | } |
669 | 667 | |
670 | - public function offsetGet ($index) |
|
668 | + public function offsetGet($index) |
|
671 | 669 | { |
672 | - return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector); |
|
670 | + return EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $index), $this->selector); |
|
673 | 671 | } |
674 | 672 | |
675 | - public function offsetUnset ($index): void |
|
673 | + public function offsetUnset($index): void |
|
676 | 674 | { |
677 | - $this->callMethod ('RemoveAt', $index); |
|
675 | + $this->callMethod('RemoveAt', $index); |
|
678 | 676 | } |
679 | 677 | |
680 | - public function offsetExists ($index): bool |
|
678 | + public function offsetExists($index): bool |
|
681 | 679 | { |
682 | 680 | try |
683 | 681 | { |
684 | - $this->offsetGet ($index); |
|
682 | + $this->offsetGet($index); |
|
685 | 683 | } |
686 | 684 | |
687 | 685 | catch (\Exception $e) |
@@ -692,19 +690,19 @@ discard block |
||
692 | 690 | return true; |
693 | 691 | } |
694 | 692 | |
695 | - public function indexOf ($value): int |
|
693 | + public function indexOf($value): int |
|
696 | 694 | { |
697 | - return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
695 | + return $this->callMethod('IndexOf', EngineAdditions::uncoupleSelector($value)); |
|
698 | 696 | } |
699 | 697 | |
700 | - public function lastIndexOf ($value): int |
|
698 | + public function lastIndexOf($value): int |
|
701 | 699 | { |
702 | - return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
700 | + return $this->callMethod('LastIndexOf', EngineAdditions::uncoupleSelector($value)); |
|
703 | 701 | } |
704 | 702 | |
705 | - public function contains ($value): bool |
|
703 | + public function contains($value): bool |
|
706 | 704 | { |
707 | - return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value)); |
|
705 | + return $this->callMethod('Contains', EngineAdditions::uncoupleSelector($value)); |
|
708 | 706 | } |
709 | 707 | |
710 | 708 | public function foreach (callable $callback, string $type = null): void |
@@ -712,71 +710,71 @@ discard block |
||
712 | 710 | $size = $this->count; |
713 | 711 | |
714 | 712 | for ($i = 0; $i < $size; ++$i) |
715 | - $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
713 | + $callback(EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
716 | 714 | } |
717 | 715 | |
718 | - public function where (callable $comparator, string $type = null): array |
|
716 | + public function where(callable $comparator, string $type = null): array |
|
719 | 717 | { |
720 | 718 | $size = $this->count; |
721 | 719 | $return = []; |
722 | 720 | |
723 | 721 | for ($i = 0; $i < $size; ++$i) |
724 | - if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
722 | + if ($comparator($value = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
725 | 723 | $return[] = $value; |
726 | 724 | |
727 | 725 | return $return; |
728 | 726 | } |
729 | 727 | |
730 | - protected function getProperty ($name) |
|
728 | + protected function getProperty($name) |
|
731 | 729 | { |
732 | 730 | try |
733 | 731 | { |
734 | - return VoidEngine::getProperty ($this->selector, $name); |
|
732 | + return VoidEngine::getProperty($this->selector, $name); |
|
735 | 733 | } |
736 | 734 | |
737 | 735 | catch (\Throwable $e) |
738 | 736 | { |
739 | - return VoidEngine::getField ($this->selector, $name); |
|
737 | + return VoidEngine::getField($this->selector, $name); |
|
740 | 738 | } |
741 | 739 | } |
742 | 740 | |
743 | - protected function setProperty ($name, $value) |
|
741 | + protected function setProperty($name, $value) |
|
744 | 742 | { |
745 | 743 | try |
746 | 744 | { |
747 | - VoidEngine::setProperty ($this->selector, $name, $value); |
|
745 | + VoidEngine::setProperty($this->selector, $name, $value); |
|
748 | 746 | } |
749 | 747 | |
750 | 748 | catch (\Throwable $e) |
751 | 749 | { |
752 | - VoidEngine::setField ($this->selector, $name, $value); |
|
750 | + VoidEngine::setField($this->selector, $name, $value); |
|
753 | 751 | } |
754 | 752 | } |
755 | 753 | |
756 | - protected function callMethod ($method, ...$args) |
|
754 | + protected function callMethod($method, ...$args) |
|
757 | 755 | { |
758 | - return VoidEngine::callMethod ($this->selector, $method, ...$args); |
|
756 | + return VoidEngine::callMethod($this->selector, $method, ...$args); |
|
759 | 757 | } |
760 | 758 | |
761 | - protected function getArrayProperty ($name, string $type = null) |
|
759 | + protected function getArrayProperty($name, string $type = null) |
|
762 | 760 | { |
763 | - $array = $this->getProperty ($name); |
|
764 | - $size = VoidEngine::getProperty ($array, 'Length'); |
|
761 | + $array = $this->getProperty($name); |
|
762 | + $size = VoidEngine::getProperty($array, 'Length'); |
|
765 | 763 | $return = []; |
766 | 764 | |
767 | 765 | for ($i = 0; $i < $size; ++$i) |
768 | - $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]); |
|
766 | + $return[] = VoidEngine::getArrayValue($array, $type === null ? $i : [$i, $type]); |
|
769 | 767 | |
770 | - VoidEngine::removeObjects ($array); |
|
768 | + VoidEngine::removeObjects($array); |
|
771 | 769 | |
772 | 770 | return $return; |
773 | 771 | } |
774 | 772 | |
775 | - public function get_name () |
|
773 | + public function get_name() |
|
776 | 774 | { |
777 | 775 | try |
778 | 776 | { |
779 | - return $this->getProperty ('Name'); |
|
777 | + return $this->getProperty('Name'); |
|
780 | 778 | } |
781 | 779 | |
782 | 780 | catch (\Throwable $e) |
@@ -785,11 +783,11 @@ discard block |
||
785 | 783 | } |
786 | 784 | } |
787 | 785 | |
788 | - public function set_name (string $name) |
|
786 | + public function set_name(string $name) |
|
789 | 787 | { |
790 | 788 | try |
791 | 789 | { |
792 | - $this->setProperty ('Name', $name); |
|
790 | + $this->setProperty('Name', $name); |
|
793 | 791 | } |
794 | 792 | |
795 | 793 | catch (\Throwable $e) |
@@ -798,9 +796,9 @@ discard block |
||
798 | 796 | } |
799 | 797 | } |
800 | 798 | |
801 | - public function __toString (): string |
|
799 | + public function __toString(): string |
|
802 | 800 | { |
803 | - return $this->callMethod ('ToString'); |
|
801 | + return $this->callMethod('ToString'); |
|
804 | 802 | } |
805 | 803 | } |
806 | 804 | |
@@ -808,16 +806,16 @@ discard block |
||
808 | 806 | { |
809 | 807 | protected $selector; |
810 | 808 | |
811 | - public function __construct ($class, ?string $classGroup = 'auto') |
|
809 | + public function __construct($class, ?string $classGroup = 'auto') |
|
812 | 810 | { |
813 | - if (is_string ($class)) |
|
814 | - $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ? |
|
815 | - substr ($class, 0, strrpos ($class, '.')) : $classGroup |
|
811 | + if (is_string($class)) |
|
812 | + $this->selector = VoidEngine::createClass($class, $classGroup == 'auto' ? |
|
813 | + substr ($class, 0, strrpos($class, '.')) : $classGroup |
|
816 | 814 | ); |
817 | 815 | |
818 | - elseif (is_int ($class) && VoidEngine::objectExists ($class)) |
|
816 | + elseif (is_int($class) && VoidEngine::objectExists($class)) |
|
819 | 817 | $this->selector = $class; |
820 | 818 | |
821 | - else throw new \Exception ('$class parameter must be string or class selector'); |
|
819 | + else throw new \Exception('$class parameter must be string or class selector'); |
|
822 | 820 | } |
823 | 821 | } |
@@ -380,30 +380,37 @@ discard block |
||
380 | 380 | |
381 | 381 | public static function compile (string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array |
382 | 382 | { |
383 | - if ($dictionary === null) |
|
384 | - $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null); |
|
383 | + if ($dictionary === null) { |
|
384 | + $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null); |
|
385 | + } |
|
385 | 386 | |
386 | - if ($assemblies === null) |
|
387 | - $assemblies = getNetArray ('System.String', [ |
|
387 | + if ($assemblies === null) { |
|
388 | + $assemblies = getNetArray ('System.String', [ |
|
388 | 389 | // CORE_DIR .'/CefSharp.dll', |
389 | 390 | CORE_DIR .'/FastColoredTextBox.dll', |
390 | 391 | CORE_DIR .'/ScintillaNET.dll' |
391 | 392 | ]); |
393 | + } |
|
392 | 394 | |
393 | - if ($productName === null) |
|
394 | - $productName = basenameNoExt ($savePath); |
|
395 | + if ($productName === null) { |
|
396 | + $productName = basenameNoExt ($savePath); |
|
397 | + } |
|
395 | 398 | |
396 | - if ($productDescription === null) |
|
397 | - $productDescription = $productName; |
|
399 | + if ($productDescription === null) { |
|
400 | + $productDescription = $productName; |
|
401 | + } |
|
398 | 402 | |
399 | - if ($productVersion === null) |
|
400 | - $productVersion = '1.0'; |
|
403 | + if ($productVersion === null) { |
|
404 | + $productVersion = '1.0'; |
|
405 | + } |
|
401 | 406 | |
402 | - if ($companyName === null) |
|
403 | - $companyName = 'Company N'; |
|
407 | + if ($companyName === null) { |
|
408 | + $companyName = 'Company N'; |
|
409 | + } |
|
404 | 410 | |
405 | - if ($copyright === null) |
|
406 | - $copyright = $companyName .' copyright (c) '. date ('Y'); |
|
411 | + if ($copyright === null) { |
|
412 | + $copyright = $companyName .' copyright (c) '. date ('Y'); |
|
413 | + } |
|
407 | 414 | |
408 | 415 | return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names; |
409 | 416 | } |
@@ -416,9 +423,7 @@ discard block |
||
416 | 423 | try |
417 | 424 | { |
418 | 425 | (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path); |
419 | - } |
|
420 | - |
|
421 | - catch (\Throwable $e) |
|
426 | + } catch (\Throwable $e) |
|
422 | 427 | { |
423 | 428 | return false; |
424 | 429 | } |
@@ -430,8 +435,9 @@ discard block |
||
430 | 435 | { |
431 | 436 | $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name); |
432 | 437 | |
433 | - if (!is_int ($property)) |
|
434 | - return false; |
|
438 | + if (!is_int ($property)) { |
|
439 | + return false; |
|
440 | + } |
|
435 | 441 | |
436 | 442 | try |
437 | 443 | { |
@@ -474,9 +480,7 @@ discard block |
||
474 | 480 | VoidEngine::getProperty ($selector, [$name, 'int']); |
475 | 481 | |
476 | 482 | $property = 'int'; |
477 | - } |
|
478 | - |
|
479 | - catch (\Throwable $e) |
|
483 | + } catch (\Throwable $e) |
|
480 | 484 | { |
481 | 485 | return [ |
482 | 486 | 'type' => 'vrsf', |
@@ -485,9 +489,7 @@ discard block |
||
485 | 489 | } |
486 | 490 | break; |
487 | 491 | } |
488 | - } |
|
489 | - |
|
490 | - catch (\Throwable $e) |
|
492 | + } catch (\Throwable $e) |
|
491 | 493 | { |
492 | 494 | $property = 'object'; |
493 | 495 | } |
@@ -505,8 +507,9 @@ discard block |
||
505 | 507 | $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents'); |
506 | 508 | $len = VoidEngine::getProperty ($props, 'Length'); |
507 | 509 | |
508 | - for ($i = 0; $i < $len; ++$i) |
|
509 | - $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name'); |
|
510 | + for ($i = 0; $i < $len; ++$i) { |
|
511 | + $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name'); |
|
512 | + } |
|
510 | 513 | |
511 | 514 | return $events; |
512 | 515 | } |
@@ -536,40 +539,38 @@ discard block |
||
536 | 539 | |
537 | 540 | public function __construct ($object, ?string $classGroup = 'auto', ...$args) |
538 | 541 | { |
539 | - foreach ($args as $id => $arg) |
|
540 | - $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
542 | + foreach ($args as $id => $arg) { |
|
543 | + $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
544 | + } |
|
541 | 545 | |
542 | - if (is_string ($object)) |
|
543 | - $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ? |
|
546 | + if (is_string ($object)) { |
|
547 | + $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ? |
|
544 | 548 | substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args); |
545 | - |
|
546 | - elseif (is_int ($object) && VoidEngine::objectExists ($object)) |
|
547 | - $this->selector = $object; |
|
548 | - |
|
549 | - else throw new \Exception ('$object parameter must be string or object selector'); |
|
549 | + } elseif (is_int ($object) && VoidEngine::objectExists ($object)) { |
|
550 | + $this->selector = $object; |
|
551 | + } else { |
|
552 | + throw new \Exception ('$object parameter must be string or object selector'); |
|
553 | + } |
|
550 | 554 | } |
551 | 555 | |
552 | 556 | public function __get ($name) |
553 | 557 | { |
554 | - if (method_exists ($this, $method = "get_$name")) |
|
555 | - $value = $this->$method (); |
|
556 | - |
|
557 | - elseif (substr ($name, -5) == 'Event') |
|
558 | - $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5)); |
|
559 | - |
|
560 | - elseif (property_exists ($this, $name)) |
|
561 | - $value = $this->$name; |
|
562 | - |
|
563 | - else switch (strtolower ($name)) |
|
558 | + if (method_exists ($this, $method = "get_$name")) { |
|
559 | + $value = $this->$method (); |
|
560 | + } elseif (substr ($name, -5) == 'Event') { |
|
561 | + $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5)); |
|
562 | + } elseif (property_exists ($this, $name)) { |
|
563 | + $value = $this->$name; |
|
564 | + } else { |
|
565 | + switch (strtolower ($name)) |
|
564 | 566 | { |
565 | 567 | case 'count': |
566 | 568 | case 'length': |
567 | 569 | try |
568 | 570 | { |
569 | 571 | return $this->getProperty ('Count'); |
570 | - } |
|
571 | - |
|
572 | - catch (\Throwable $e) |
|
572 | + } |
|
573 | + } catch (\Throwable $e) |
|
573 | 574 | { |
574 | 575 | return $this->getProperty ('Length'); |
575 | 576 | } |
@@ -579,8 +580,9 @@ discard block |
||
579 | 580 | $size = $this->count; |
580 | 581 | $list = []; |
581 | 582 | |
582 | - for ($i = 0; $i < $size; ++$i) |
|
583 | - $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i)); |
|
583 | + for ($i = 0; $i < $size; ++$i) { |
|
584 | + $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i)); |
|
585 | + } |
|
584 | 586 | |
585 | 587 | return $list; |
586 | 588 | break; |
@@ -589,13 +591,12 @@ discard block |
||
589 | 591 | $size = $this->count; |
590 | 592 | $names = []; |
591 | 593 | |
592 | - for ($i = 0; $i < $size; ++$i) |
|
593 | - try |
|
594 | + for ($i = 0; $i < $size; ++$i) { |
|
595 | + try |
|
594 | 596 | { |
595 | 597 | $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text'); |
596 | - } |
|
597 | - |
|
598 | - catch (\Throwable $e) |
|
598 | + } |
|
599 | + } catch (\Throwable $e) |
|
599 | 600 | { |
600 | 601 | $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']); |
601 | 602 | } |
@@ -613,10 +614,11 @@ discard block |
||
613 | 614 | |
614 | 615 | public function __set ($name, $value) |
615 | 616 | { |
616 | - if (method_exists ($this, $method = "set_$name")) |
|
617 | - try |
|
617 | + if (method_exists ($this, $method = "set_$name")) { |
|
618 | + try |
|
618 | 619 | { |
619 | 620 | return $this->$method ($value); |
621 | + } |
|
620 | 622 | } |
621 | 623 | |
622 | 624 | # Метод "set_$name" может принимать в качестве параметра объект WFObject |
@@ -626,12 +628,11 @@ discard block |
||
626 | 628 | { |
627 | 629 | return $value instanceof WFObject ? |
628 | 630 | $this->$method ($value->selector) : null; |
629 | - } |
|
630 | - |
|
631 | - elseif (substr ($name, -5) == 'Event') |
|
632 | - Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value); |
|
633 | - |
|
634 | - else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
631 | + } elseif (substr ($name, -5) == 'Event') { |
|
632 | + Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value); |
|
633 | + } else { |
|
634 | + $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
635 | + } |
|
635 | 636 | } |
636 | 637 | |
637 | 638 | public function __call ($method, $args) |
@@ -646,8 +647,9 @@ discard block |
||
646 | 647 | |
647 | 648 | public function addRange (array $values, $assoc = false): void |
648 | 649 | { |
649 | - foreach ($values as $id => $value) |
|
650 | - $this->offsetSet ($assoc ? $id : null, $value); |
|
650 | + foreach ($values as $id => $value) { |
|
651 | + $this->offsetSet ($assoc ? $id : null, $value); |
|
652 | + } |
|
651 | 653 | } |
652 | 654 | |
653 | 655 | public function offsetSet ($index, $value) |
@@ -657,9 +659,7 @@ discard block |
||
657 | 659 | return $index === null ? |
658 | 660 | $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) : |
659 | 661 | $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value)); |
660 | - } |
|
661 | - |
|
662 | - catch (\Throwable $e) |
|
662 | + } catch (\Throwable $e) |
|
663 | 663 | { |
664 | 664 | return $index === null ? |
665 | 665 | VoidEngine::setArrayValue ($this->selector, $this->count, $value) : |
@@ -682,9 +682,7 @@ discard block |
||
682 | 682 | try |
683 | 683 | { |
684 | 684 | $this->offsetGet ($index); |
685 | - } |
|
686 | - |
|
687 | - catch (\Exception $e) |
|
685 | + } catch (\Exception $e) |
|
688 | 686 | { |
689 | 687 | return false; |
690 | 688 | } |
@@ -711,8 +709,9 @@ discard block |
||
711 | 709 | { |
712 | 710 | $size = $this->count; |
713 | 711 | |
714 | - for ($i = 0; $i < $size; ++$i) |
|
715 | - $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
712 | + for ($i = 0; $i < $size; ++$i) { |
|
713 | + $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
714 | + } |
|
716 | 715 | } |
717 | 716 | |
718 | 717 | public function where (callable $comparator, string $type = null): array |
@@ -720,9 +719,10 @@ discard block |
||
720 | 719 | $size = $this->count; |
721 | 720 | $return = []; |
722 | 721 | |
723 | - for ($i = 0; $i < $size; ++$i) |
|
724 | - if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
722 | + for ($i = 0; $i < $size; ++$i) { |
|
723 | + if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
725 | 724 | $return[] = $value; |
725 | + } |
|
726 | 726 | |
727 | 727 | return $return; |
728 | 728 | } |
@@ -732,9 +732,7 @@ discard block |
||
732 | 732 | try |
733 | 733 | { |
734 | 734 | return VoidEngine::getProperty ($this->selector, $name); |
735 | - } |
|
736 | - |
|
737 | - catch (\Throwable $e) |
|
735 | + } catch (\Throwable $e) |
|
738 | 736 | { |
739 | 737 | return VoidEngine::getField ($this->selector, $name); |
740 | 738 | } |
@@ -745,9 +743,7 @@ discard block |
||
745 | 743 | try |
746 | 744 | { |
747 | 745 | VoidEngine::setProperty ($this->selector, $name, $value); |
748 | - } |
|
749 | - |
|
750 | - catch (\Throwable $e) |
|
746 | + } catch (\Throwable $e) |
|
751 | 747 | { |
752 | 748 | VoidEngine::setField ($this->selector, $name, $value); |
753 | 749 | } |
@@ -764,8 +760,9 @@ discard block |
||
764 | 760 | $size = VoidEngine::getProperty ($array, 'Length'); |
765 | 761 | $return = []; |
766 | 762 | |
767 | - for ($i = 0; $i < $size; ++$i) |
|
768 | - $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]); |
|
763 | + for ($i = 0; $i < $size; ++$i) { |
|
764 | + $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]); |
|
765 | + } |
|
769 | 766 | |
770 | 767 | VoidEngine::removeObjects ($array); |
771 | 768 | |
@@ -777,9 +774,7 @@ discard block |
||
777 | 774 | try |
778 | 775 | { |
779 | 776 | return $this->getProperty ('Name'); |
780 | - } |
|
781 | - |
|
782 | - catch (\Throwable $e) |
|
777 | + } catch (\Throwable $e) |
|
783 | 778 | { |
784 | 779 | return $this->name; |
785 | 780 | } |
@@ -790,9 +785,7 @@ discard block |
||
790 | 785 | try |
791 | 786 | { |
792 | 787 | $this->setProperty ('Name', $name); |
793 | - } |
|
794 | - |
|
795 | - catch (\Throwable $e) |
|
788 | + } catch (\Throwable $e) |
|
796 | 789 | { |
797 | 790 | $this->name = $name; |
798 | 791 | } |
@@ -810,14 +803,14 @@ discard block |
||
810 | 803 | |
811 | 804 | public function __construct ($class, ?string $classGroup = 'auto') |
812 | 805 | { |
813 | - if (is_string ($class)) |
|
814 | - $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ? |
|
806 | + if (is_string ($class)) { |
|
807 | + $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ? |
|
815 | 808 | substr ($class, 0, strrpos ($class, '.')) : $classGroup |
816 | 809 | ); |
817 | - |
|
818 | - elseif (is_int ($class) && VoidEngine::objectExists ($class)) |
|
819 | - $this->selector = $class; |
|
820 | - |
|
821 | - else throw new \Exception ('$class parameter must be string or class selector'); |
|
810 | + } elseif (is_int ($class) && VoidEngine::objectExists ($class)) { |
|
811 | + $this->selector = $class; |
|
812 | + } else { |
|
813 | + throw new \Exception ('$class parameter must be string or class selector'); |
|
814 | + } |
|
822 | 815 | } |
823 | 816 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | protected $WinAPI; |
31 | 31 | |
32 | - public function __construct () |
|
32 | + public function __construct() |
|
33 | 33 | { |
34 | 34 | /** |
35 | 35 | * Большинство функций было взято из класса "WinAPI" проекта "DevelStudio XL" |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | */ |
42 | 42 | |
43 | - $this->WinAPI = \FFI::cdef (' |
|
43 | + $this->WinAPI = \FFI::cdef(' |
|
44 | 44 | struct LPCTSTR |
45 | 45 | { |
46 | 46 | char string; |
@@ -76,25 +76,25 @@ discard block |
||
76 | 76 | ', 'User32.dll'); |
77 | 77 | } |
78 | 78 | |
79 | - public function __call ($method, $args) |
|
79 | + public function __call($method, $args) |
|
80 | 80 | { |
81 | - if (method_exists ($this, $method)) |
|
82 | - return $this->$method (...$args); |
|
81 | + if (method_exists($this, $method)) |
|
82 | + return $this->$method(...$args); |
|
83 | 83 | |
84 | 84 | else try |
85 | 85 | { |
86 | - return $this->WinAPI->$method (...$args); |
|
86 | + return $this->WinAPI->$method(...$args); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | catch (\Throwable $e) |
90 | 90 | { |
91 | - throw new \Exception ('Method "'. $method .'" not found or return an exception. Exception info: '. "\n\n". (string) $e); |
|
91 | + throw new \Exception('Method "'.$method.'" not found or return an exception. Exception info: '."\n\n".(string) $e); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - public function findWindow (string $caption, string $class = null): ?int |
|
95 | + public function findWindow(string $caption, string $class = null): ?int |
|
96 | 96 | { |
97 | - return $this->FindWindowA ($class, $caption); |
|
97 | + return $this->FindWindowA($class, $caption); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /*public function getWindowCaption (int $handle) |
@@ -78,15 +78,14 @@ |
||
78 | 78 | |
79 | 79 | public function __call ($method, $args) |
80 | 80 | { |
81 | - if (method_exists ($this, $method)) |
|
82 | - return $this->$method (...$args); |
|
83 | - |
|
84 | - else try |
|
81 | + if (method_exists ($this, $method)) { |
|
82 | + return $this->$method (...$args); |
|
83 | + } else { |
|
84 | + try |
|
85 | 85 | { |
86 | 86 | return $this->WinAPI->$method (...$args); |
87 | 87 | } |
88 | - |
|
89 | - catch (\Throwable $e) |
|
88 | + } catch (\Throwable $e) |
|
90 | 89 | { |
91 | 90 | throw new \Exception ('Method "'. $method .'" not found or return an exception. Exception info: '. "\n\n". (string) $e); |
92 | 91 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | public $name; // Имя объекта |
43 | 43 | public $link; // АСД-ссылка на объект |
44 | 44 | |
45 | - public function __construct (string $name, int $link) |
|
45 | + public function __construct(string $name, int $link) |
|
46 | 46 | { |
47 | 47 | $this->name = $name; |
48 | 48 | $this->link = $link; |