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

PushNotificationsHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 19
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
A shouldHandle() 0 3 1
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());
1 ignored issue
show
Bug introduced by
The method assemble() does not exist on Namshi\Notificator\NotificationInterface. It seems like you code against a sub-type of Namshi\Notificator\NotificationInterface such as Gewaer\Contracts\PushNotificationsContract or Gewaer\Notifications\Pus...tions\PushNotifications. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        Di::getDefault()->getLog()->info($notification->/** @scrutinizer ignore-call */ assemble());
Loading history...
34
    }
35
}
36