Passed
Push — master ( b9ffdf...6f7a22 )
by Hirofumi
04:56
created

NotificationNotSentException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 33
ccs 10
cts 12
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A notification() 0 4 1
1
<?php
2
3
namespace Shippinno\Notification\Domain\Model;
4
5
use DateTime;
6
use Exception;
7
use Throwable;
8
9
class NotificationNotSentException extends Exception
10
{
11
    /**
12
     * @var Notification
13
     */
14
    private $notification;
15
16
    /**
17
     * @param Notification $notification
18
     * @param Throwable|null $previous
19
     */
20 1
    public function __construct(Notification $notification, Throwable $previous = null)
21
    {
22 1
        $this->notification = $notification;
23 1
        parent::__construct(
24 1
            sprintf(
25 1
                'Failed to send notification: "%s" created at %s',
26 1
                $notification->subject()->subject(),
27 1
                $notification->createdAt()->format(DateTime::W3C)
28
            ),
29 1
            0,
30 1
            $previous
31
        );
32 1
    }
33
34
    /**
35
     * @return Notification
36
     */
37
    public function notification(): Notification
38
    {
39
        return $this->notification;
40
    }
41
}
42