| Total Complexity | 10 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 76.92% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class CallbackProcessor implements ProcessorInterface |
||
| 19 | { |
||
| 20 | private readonly ?\Closure $begin; |
||
| 21 | |||
| 22 | private readonly ?\Closure $item; |
||
| 23 | |||
| 24 | private readonly ?\Closure $end; |
||
| 25 | |||
| 26 | 1 | public function __construct(?callable $begin = null, ?callable $item = null, ?callable $end = null) |
|
| 27 | { |
||
| 28 | 1 | $this->begin = $begin ? $begin(...) : null; |
|
|
|
|||
| 29 | 1 | $this->item = $item ? $item(...) : null; |
|
| 30 | 1 | $this->end = $end ? $end(...) : null; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function begin(Message $message): void |
|
| 34 | { |
||
| 35 | 1 | if (null !== $this->begin) { |
|
| 36 | ($this->begin)($message); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | 1 | public function item(Message $message): void |
|
| 41 | { |
||
| 42 | 1 | if (null !== $this->item) { |
|
| 43 | ($this->item)($message); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 1 | public function end(Message $message): void |
|
| 51 | } |
||
| 52 | } |
||
| 53 | } |
||
| 54 |