1 | <?php |
||
29 | abstract class Notification { |
||
30 | |||
31 | /** |
||
32 | * @var string Specifies to which shared resource the notification belong to |
||
33 | */ |
||
34 | protected $providerId; |
||
35 | |||
36 | /** |
||
37 | * @var string Resource-specific type of the notification. |
||
38 | */ |
||
39 | protected $notificationType; |
||
40 | |||
41 | /** |
||
42 | * @var string[] Payload of the notification |
||
43 | */ |
||
44 | protected $notificationData = []; |
||
45 | |||
46 | /** |
||
47 | * Get all available notification types for this resource type |
||
48 | * |
||
49 | * @return string[] |
||
50 | */ |
||
51 | abstract public function getNotificationTypes(); |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | abstract public function getResourceType(); |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getProviderId() { |
||
64 | |||
65 | /** |
||
66 | * @param string $providerId |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function setProviderId($providerId) { |
||
73 | |||
74 | /** |
||
75 | * Check if notification is supported |
||
76 | * |
||
77 | * @param string $type |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function isValidNotificationType($type) { |
||
84 | |||
85 | /** |
||
86 | * @param string $field |
||
87 | * @param mixed $value |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | public function addNotificationData($field, $value) { |
||
94 | |||
95 | /** |
||
96 | * Prepare notification |
||
97 | * |
||
98 | * @return array |
||
99 | */ |
||
100 | public function toArray() { |
||
108 | } |
||
109 |