1 | <?php |
||
2 | |||
3 | namespace Gewaer\Handlers; |
||
4 | |||
5 | use Namshi\Notificator\Notification\Handler\HandlerInterface; |
||
6 | use Gewaer\Contracts\PushNotificationsContract; |
||
7 | use Phalcon\Http\Response; |
||
8 | use Namshi\Notificator\NotificationInterface; |
||
9 | use Phalcon\Di; |
||
10 | use Gewaer\Notifications\PushNotifications\AppsPushNotifications; |
||
11 | use Gewaer\Notifications\PushNotifications\PushNotifications; |
||
12 | use Gewaer\Models\Notifications; |
||
13 | use Gewaer\Traits\NotificationsTrait; |
||
14 | use Gewaer\Models\SystemModules; |
||
15 | |||
16 | class PushNotificationsHandler implements HandlerInterface |
||
17 | { |
||
18 | /** |
||
19 | * Notifications Trait |
||
20 | */ |
||
21 | use NotificationsTrait; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
22 | |||
23 | /** |
||
24 | * Stablishes type of handler |
||
25 | */ |
||
26 | public function shouldHandle(NotificationInterface $notification) |
||
27 | { |
||
28 | return $notification instanceof PushNotificationsContract; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Handles actions to take depending of notifications |
||
33 | * @param NotificationInterface $notification |
||
34 | */ |
||
35 | public function handle(NotificationInterface $notification) |
||
36 | { |
||
37 | $this->create($notification->user,$notification->content,$notification->notificationTypeId,$notification->systemModule); |
||
0 ignored issues
–
show
|
|||
38 | die(); |
||
39 | $notificationType = $notification->notificationTypeId; |
||
0 ignored issues
–
show
$notificationType = $not...ion->notificationTypeId is not reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() |
|||
40 | |||
41 | switch ($notificationType) { |
||
42 | case '1': |
||
43 | $newTypeRecord = new AppsPushNotifications($notification->getMessage(), $notification->notificationTypeId); |
||
44 | Di::getDefault()->getLog()->info($newTypeRecord->getMessage()); |
||
45 | break; |
||
46 | // case '2': |
||
47 | // $notificationType = new AppsPushNotifications($notification->getMessage(), $notification->source_id); |
||
48 | // Di::getDefault()->getLog()->info($notificationType->getMessage()); |
||
49 | // break; |
||
50 | |||
51 | // case '3': |
||
52 | // $notificationType = new AppsPushNotifications($notification->getMessage(), $notification->source_id); |
||
53 | // Di::getDefault()->getLog()->info($notificationType->getMessage()); |
||
54 | // break; |
||
55 | |||
56 | default: |
||
57 | $newTypeRecord = new PushNotifications($notification->getMessage(), $notification->notificationTypeId); |
||
58 | Di::getDefault()->getLog()->info($newTypeRecord->getMessage()); |
||
59 | break; |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 |