Pusher::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Canvas\Cli\Jobs;
4
5
use Canvas\Contracts\Queue\QueueableJobInterface;
6
use Canvas\Jobs\Job;
7
use Canvas\Notifications\PusherNotification;
8
use Phalcon\Di;
9
10
class Pusher extends Job implements QueueableJobInterface
11
{
12
    /**
13
     * Realtime channel.
14
     *
15
     * @var string
16
     */
17
    protected $channel;
18
19
    /**
20
     * Realtime event.
21
     *
22
     * @var string
23
     */
24
    protected $event;
25
26
    /**
27
     * Realtime params.
28
     *
29
     * @var array
30
     */
31
    protected $params;
32
33
    /**
34
     * Constructor setup info for Pusher.
35
     *
36
     * @param string $channel
37
     * @param string $event
38
     * @param array $params
39
     */
40
    public function __construct(PusherNotification $pusherNotification)
41
    {
42
        $this->channel = $pusherNotification->channel;
43
        $this->event = $pusherNotification->event;
44
        $this->params = $pusherNotification->params;
45
    }
46
47
    /**
48
     * Handle the pusher request.
49
     *
50
     * @return void
51
     */
52
    public function handle()
53
    {
54
        $pusher = Di::getDefault()->getPusher();
55
        return $pusher->trigger($this->channel, $this->event, $this->params);
56
    }
57
}
58