| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Event |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var object the class firing the event. |
||
| 11 | */ |
||
| 12 | public $owner; |
||
| 13 | /** |
||
| 14 | * @var array the collected arguments passed to the event |
||
| 15 | */ |
||
| 16 | private $data; |
||
| 17 | /** |
||
| 18 | * @var callable |
||
| 19 | */ |
||
| 20 | private $handler; |
||
| 21 | /** |
||
| 22 | * Callback constructor. |
||
| 23 | * |
||
| 24 | * @param callable $handler |
||
| 25 | */ |
||
| 26 | 5 | public function __construct($handler) |
|
| 27 | { |
||
| 28 | 5 | if (!is_callable($handler)) { |
|
| 29 | 1 | throw new InvalidCallbackArgumentException('Argument is not callable!'); |
|
| 30 | } |
||
| 31 | 4 | $this->handler = $handler; |
|
| 32 | 4 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | 4 | public function __invoke() |
|
| 41 | 4 | } |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @return array the collected arguments passed to the event |
||
| 45 | */ |
||
| 46 | public function getData() |
||
| 49 | 4 | } |
|
| 50 | } |
||
| 51 |