1 | <?php |
||
9 | class Notifier extends Observable |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * @var \Monitor\Notification\Parser |
||
14 | */ |
||
15 | private $notificationParser; |
||
16 | /** |
||
17 | * @var \Monitor\Service\NotificationLog |
||
18 | */ |
||
19 | private $notificationLogService; |
||
20 | /** |
||
21 | * Notification repository |
||
22 | * @var \Doctrine\ORM\EntityRepository |
||
23 | */ |
||
24 | private $repository; |
||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $notificationData; |
||
29 | |||
30 | public function __construct( |
||
40 | |||
41 | /** |
||
42 | * Add notification data, we will use them in notification services |
||
43 | * |
||
44 | * @param array $data |
||
45 | */ |
||
46 | public function setNotificationData(array $data) |
||
50 | /** |
||
51 | * Get Notification by id |
||
52 | * |
||
53 | * @param int $id |
||
54 | * @return \Monitor\Model\Notification $notification |
||
55 | */ |
||
56 | private function getNotificationById($id) |
||
61 | |||
62 | /** |
||
63 | * Parse notification message |
||
64 | * |
||
65 | * @param \Monitor\Model\Notification $notification |
||
66 | * @param array $data |
||
67 | */ |
||
68 | private function parseNotification(Notification $notification, $data) |
||
72 | |||
73 | /** |
||
74 | * Prepare notification |
||
75 | * |
||
76 | * @access private |
||
77 | * @param Trigger $trigger |
||
78 | * @param array $serverData |
||
79 | * @return \Monitor\Notification\Notification |
||
80 | */ |
||
81 | private function prepareNotification(Trigger $trigger, array $serverData) |
||
93 | |||
94 | /** |
||
95 | * |
||
96 | * |
||
97 | * @param Trigger $trigger |
||
98 | * @param array $serverData |
||
99 | * @return \Monitor\Notification\Notification |
||
100 | */ |
||
101 | public function triggerHasBeenFired(Trigger $trigger, array $serverData) |
||
107 | |||
108 | /** |
||
109 | * Send notification to notification service |
||
110 | * |
||
111 | * @access public |
||
112 | * @param Notification $notification |
||
113 | * @return |
||
114 | */ |
||
115 | public function notifyServices(Notification $notification) |
||
121 | } |
||
122 |