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

Enqueue   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 4 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