| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function handle($event) |
||
| 19 | { |
||
| 20 | $checker = $event->checker; |
||
| 21 | |||
| 22 | if (!$checker instanceof CheckerSendsNotifications) { |
||
| 23 | return; |
||
| 24 | } |
||
| 25 | |||
| 26 | $state = new CheckerState($checker); |
||
| 27 | |||
| 28 | if (!$state->shouldSentFailedNotification()) { |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | |||
| 32 | $notificationClass = $checker->failedNotificationClass(); |
||
| 33 | |||
| 34 | $notification = $this->sendNotification( |
||
| 35 | new $notificationClass($checker, $event->exception, $event->failedData) |
||
| 36 | ); |
||
| 37 | |||
| 38 | $notification ? $state->markSentFailedNotification($notification) : null; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |