SingleSender   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 8 1
1
<?php
2
3
namespace Fenos\Notifynder\Senders;
4
5
use Fenos\Notifynder\Models\Notification;
6
use Fenos\Notifynder\Contracts\SenderContract;
7
use Fenos\Notifynder\Contracts\SenderManagerContract;
8
9
/**
10
 * Class SingleSender.
11
 */
12
class SingleSender implements SenderContract
13
{
14
    /**
15
     * @var \Fenos\Notifynder\Builder\Notification
16
     */
17
    protected $notification;
18
19
    /**
20
     * SingleSender constructor.
21
     *
22
     * @param array $notifications
23
     */
24
    public function __construct(array $notifications)
25
    {
26
        $this->notification = array_values($notifications)[0];
27
    }
28
29
    /**
30
     * Send the single notification.
31
     *
32
     * @param SenderManagerContract $sender
33
     * @return bool
34
     */
35
    public function send(SenderManagerContract $sender)
36
    {
37
        $model = app('notifynder.resolver.model')->getModel(Notification::class);
38
39
        $notification = new $model($this->notification);
40
41
        return $notification->save();
42
    }
43
}
44