Test Failed
Pull Request — master (#70)
by Rafael
06:01
created

PushNotifications   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 72
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A assemble() 0 3 1
A system() 0 11 1
A __construct() 0 3 1
A users() 0 11 1
A apps() 0 11 1
1
<?php
2
3
namespace Gewaer\Notifications\PushNotifications;
4
5
use Namshi\Notificator\Notification;
6
use Gewaer\Contracts\PushNotificationsContract;
7
use Gewaer\Models\Users;
8
use Gewaer\Notifications\PushNotifications\AppsPushNotifications;
9
use Gewaer\Notifications\PushNotifications\UsersPushNotifications;
10
use Gewaer\Notifications\PushNotifications\SystemPushNotifications;
11
use Phalcon\Di;
12
13
class PushNotifications extends Notification implements PushNotificationsContract
14
{
15
16
    public $user;
17
18
    public $content;
19
20
    public $systemModule;
21
22
    public function __construct(string $content)
23
    {
24
        $this->content  = $content;
25
    }
26
27
    /**
28
     * Assemble Notification
29
     */
30
    public function assemble()
31
    {
32
        return $this->content;
33
    }
34
35
    /**
36
     * Create a new Apps Notification
37
     * @return void
38
     */
39
    public static function apps(string $content, string $systemModule): void
40
    {
41
        /**
42
         * Create a new Apps Push Notification
43
         */
44
        $notification =  new AppsPushNotifications(Di::getDefault()->getUserData(),$content,$systemModule);
45
46
        /**
47
         * Send to notifications queue
48
         */
49
        Di::getDefault()->getManager()->trigger($notification);
50
51
    }
0 ignored issues
show
Coding Style introduced by
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Loading history...
52
53
    /**
54
     * Create a new Users Notification
55
     * @return void
56
     */
57
    public static function users(string $content, string $systemModule): void
58
    {
59
        /**
60
         * Create a new Apps Push Notification
61
         */
62
        $notification =  new UsersPushNotifications(Di::getDefault()->getUserData(),$content,$systemModule);
63
64
        /**
65
         * Send to notifications queue
66
         */
67
        Di::getDefault()->getManager()->trigger($notification);
68
    }
69
70
    /**
71
     * Create a new System Notification
72
     * @return void
73
     */
74
    public static function system(string $content, string $systemModule): void
75
    {
76
        /**
77
         * Create a new Apps Push Notification
78
         */
79
        $notification =  new SystemPushNotifications(Di::getDefault()->getUserData(),$content,$systemModule);
80
81
        /**
82
         * Send to notifications queue
83
         */
84
        Di::getDefault()->getManager()->trigger($notification);
85
    }
86
}
87