1 | <?php |
||
8 | abstract class Event |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $webhookData; |
||
14 | |||
15 | /** |
||
16 | * @var \Illuminate\Http\Request |
||
17 | */ |
||
18 | protected $request; |
||
19 | |||
20 | public function __construct(array $webhookData, Request $request) |
||
25 | |||
26 | /** |
||
27 | * Getter for all data. |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | public function all(): array |
||
35 | |||
36 | /** |
||
37 | * Getter for the request. |
||
38 | * |
||
39 | * @return \Illuminate\Http\Request |
||
40 | */ |
||
41 | public function getRequest(): Request |
||
45 | |||
46 | /** |
||
47 | * Getter for the webhook data. |
||
48 | * |
||
49 | * @param string $key |
||
50 | * @return mixed |
||
51 | */ |
||
52 | public function __get(string $key) |
||
66 | |||
67 | /** |
||
68 | * Determine if an attribute exists on the webhook data. |
||
69 | * |
||
70 | * @param string $key |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function __isset($key) |
||
77 | |||
78 | /** |
||
79 | * Generates the event class name with the 'alert_name' attribute from |
||
80 | * the data and fires the event with the data. |
||
81 | * |
||
82 | * @param array $data |
||
83 | * @param \Illuminate\Http\Request $request |
||
84 | * @return void |
||
85 | */ |
||
86 | public static function fire(array $data, Request $request) |
||
94 | } |
||
95 |