1 | <?php |
||
6 | trait SupportsEvents |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * The event dispatcher instance. |
||
11 | * |
||
12 | * @var \Illuminate\Events\Dispatcher |
||
13 | */ |
||
14 | protected $events; |
||
15 | |||
16 | /** |
||
17 | * Get the event dispatcher used by the object. |
||
18 | * |
||
19 | * @return \Illuminate\Events\Dispatcher |
||
20 | */ |
||
21 | 36 | public function getEventDispatcher() |
|
25 | |||
26 | /** |
||
27 | * Set the event dispatcher instance on the object. |
||
28 | * |
||
29 | * In order to support both Laravel 4 and Laravel 5, the events |
||
30 | * parameter is typehinted to the implementation and not the |
||
31 | * interface, as the interface doesn't exist in Laravel 4. |
||
32 | * |
||
33 | * @param \Illuminate\Events\Dispatcher $events |
||
34 | * @return void |
||
35 | */ |
||
36 | 55 | public function setEventDispatcher(Dispatcher $events) |
|
40 | |||
41 | /** |
||
42 | * Unset the event dispatcher instance on the object. |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | 12 | public function unsetEventDispatcher() |
|
47 | { |
||
48 | 12 | $this->events = null; |
|
49 | 12 | } |
|
50 | |||
51 | /** |
||
52 | * Check if the object is using events. |
||
53 | * |
||
54 | * @return boolean |
||
55 | */ |
||
56 | 47 | public function usingEvents() |
|
60 | |||
61 | /** |
||
62 | * Fire the given event for the object. |
||
63 | * |
||
64 | * @param object $event |
||
65 | * @param boolean $halt |
||
66 | * @return mixed |
||
67 | */ |
||
68 | 39 | protected function fireEvent($event, $halt = false) |
|
78 | } |
||
79 |