Test Failed
Pull Request — master (#70)
by Rafael
05:34
created

PushNotificationsHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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\Models\SystemModules;
14
15
class PushNotificationsHandler implements HandlerInterface
16
{
17
    /**
18
     * Stablishes type of handler
19
     */
20
    public function shouldHandle(NotificationInterface $notification)
21
    {
22
        return $notification instanceof PushNotificationsContract;
23
    }
24
    
25
    /**
26
     * Handles actions to take depending of notifications
27
     * @param NotificationInterface $notification
28
     */
29
    public function handle(NotificationInterface $notification)
30
    {
31
32
        //Push the notification.In this case we are just logging the info
33
        Di::getDefault()->getLog()->info($notification->assemble());
34
    }
35
}
36