1 | <?php |
||
17 | final class Event |
||
18 | { |
||
19 | /** |
||
20 | * May contain extra information for the event listeners, may be any type. |
||
21 | */ |
||
22 | public $data = null; |
||
23 | |||
24 | /** |
||
25 | * The name of the event. Can be accessed through __get() but not changed. |
||
26 | */ |
||
27 | private $name = ''; |
||
28 | |||
29 | /** |
||
30 | * If set to true will make fire() return false. Cannot be changed once set to true |
||
31 | * but can be read through __get(). |
||
32 | */ |
||
33 | private $preventDefault = false; |
||
34 | |||
35 | /** |
||
36 | * @param string $name The name of the event fired. |
||
37 | * @param mixed $data Optional. Extra information for this event. |
||
38 | */ |
||
39 | 6 | public function __construct($name, $data = null) |
|
44 | |||
45 | /** |
||
46 | * Sets the flag which will make \arc\events::fire() return false. Once set it cannot be unset. |
||
47 | * @returns false |
||
48 | */ |
||
49 | 1 | public function preventDefault() |
|
55 | |||
56 | 6 | public function __get($name) |
|
67 | } |
||
68 |