Conditions | 7 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function isAccessEvent( |
||
33 | string $platform, |
||
34 | string $event, |
||
35 | object $payload |
||
36 | ): bool { |
||
37 | if (!$this->setting->isNotified()) { |
||
38 | return false; |
||
39 | } |
||
40 | |||
41 | if ($this->setting->isAllEventsNotification()) { |
||
42 | return true; |
||
43 | } |
||
44 | $this->event->setEventConfig($platform); |
||
45 | |||
46 | $eventConfig = $this->event->getEventConfig()[tgn_convert_event_name($event)] ?? false; |
||
47 | $action = $this->getActionOfEvent($payload); |
||
48 | |||
49 | if (!empty($action) && isset($eventConfig[$action])) { |
||
50 | $eventConfig = $eventConfig[$action]; |
||
51 | } |
||
52 | |||
53 | if (is_array($eventConfig) || !$eventConfig) { |
||
54 | $eventConfig = false; |
||
55 | error_log('\n Event config is not found \n'); |
||
56 | } |
||
57 | |||
58 | return $eventConfig; |
||
59 | } |
||
61 |