Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
handlestatustrait.php
1<?php
2
4
5trait HandleStatusTrait
6{
8 protected array $statusHandlers = [];
9
15 public function addStatusHandler(callable $handler): self
16 {
17 $this->statusHandlers[] = $handler;
18
19 return $this;
20 }
21
27 public function addStatusHandlerList(array $handlers): self
28 {
29 foreach ($handlers as $handler)
30 {
31 $this->statusHandlers[] = $handler;
32 }
33
34 return $this;
35 }
36
40 public function getStatusHandlerList(): array
41 {
42 return $this->statusHandlers;
43 }
44
50 protected function sendStatus($status)
51 {
52 foreach ($this->statusHandlers as $statusHandler)
53 {
54 call_user_func($statusHandler, $status);
55 }
56 }
57 //
58}
addStatusHandlerList(array $handlers)
addStatusHandler(callable $handler)