Completed
Push — master ( 03348d...edfc47 )
by Michał
08:06
created

Enqueue::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace nyx\notify\jobs;
2
3
// Internal dependencies
4
use nyx\notify\interfaces;
5
6
/**
7
 * Enqueue Job
8
 *
9
 * @package     Nyx\Notify
10
 * @version     0.1.0
11
 * @author      Michal Chojnacki <[email protected]>
12
 * @copyright   2012-2017 Nyx Dev Team
13
 * @link        https://github.com/unyx/nyx
14
 */
15
class Enqueue implements \Illuminate\Contracts\Queue\ShouldQueue
16
{
17
    /**
18
     * The traits of a Notification Queue Handler instance.
19
     */
20
    use \Illuminate\Bus\Queueable, \Illuminate\Queue\SerializesModels;
21
22
    /**
23
     * @var mixed   The entities which shall receive the wrapped Notification.
24
     */
25
    protected $notifiables;
26
27
    /**
28
     * @var interfaces\Notification The Notification that shall be sent.
29
     */
30
    protected $notification;
31
32
    /**
33
     * Creates a new Enqueue Job instance.
34
     *
35
     * @param   mixed                   $notifiables    The entities which shall receive the wrapped Notification.
36
     * @param   interfaces\Notification $notification   The Notification that shall be sent.
37
     */
38
    public function __construct($notifiables, interfaces\Notification $notification)
39
    {
40
        $this->notifiables  = $notifiables;
41
        $this->notification = $notification;
42
    }
43
44
    /**
45
     * Sends the wrapped Notification.
46
     *
47
     * @param   interfaces\Dispatcher   $dispatcher
48
     */
49
    public function handle(interfaces\Dispatcher $dispatcher)
50
    {
51
        $dispatcher->sendNow($this->notifiables, $this->notification);
52
    }
53
}
54