pjpawel /
LightApi
| 1 | <?php |
||
| 2 | |||
| 3 | namespace pjpawel\LightApi\Component\Event; |
||
| 4 | |||
| 5 | class CallbackEvent implements EventInterface |
||
| 6 | { |
||
| 7 | |||
| 8 | private \Closure $closure; |
||
| 9 | private array $arguments; |
||
| 10 | |||
| 11 | public function __construct(callable $function, array $arguments = []) |
||
| 12 | { |
||
| 13 | $this->closure = $function(...); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 14 | $this->arguments = $arguments; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function run(): mixed |
||
| 18 | { |
||
| 19 | return call_user_func($this->closure, $this->arguments); |
||
| 20 | } |
||
| 21 | } |