Completed
Push — master ( f62f21...f72c97 )
by Freek
05:09
created

Log   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 6 2
1
<?php
2
3
namespace Spatie\Backup\Notifications\Senders;
4
5
use Illuminate\Contracts\Logging\Log as LogContract;
6
use Spatie\Backup\Notifications\BaseSender;
7
8
class Log extends BaseSender
9
{
10
    /** @var \Illuminate\Contracts\Logging\Log */
11
    protected $log;
12
13
    /**
14
     * @param \Illuminate\Contracts\Logging\Log $log
15
     */
16
    public function __construct(LogContract $log)
17
    {
18
        $this->log = $log;
19
    }
20
21
    public function send()
22
    {
23
        $method = ($this->type === static::TYPE_SUCCESS ? 'info' : 'error');
24
25
        $this->log->$method("{$this->subject}: {$this->message}");
26
    }
27
}
28