Passed
Push — master ( 79f40f...37a828 )
by Hirofumi
02:31
created

NotificationLockedException::notification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shippinno\Notification\Domain\Model;
5
6
use DateTime;
7
use Exception;
8
9 View Code Duplication
class NotificationLockedException extends Exception
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /**
12
     * @var Notification
13
     */
14
    private $notification;
15
16
    /**
17
     * @param Notification $notification
18
     */
19 1
    public function __construct(Notification $notification)
20
    {
21 1
        $this->notification = $notification;
22 1
        parent::__construct(
23 1
            sprintf(
24 1
                'Cannot send locked notification: "%s" created at %s',
25 1
                $this->notification->subject()->subject(),
26 1
                $this->notification->createdAt()->format(DateTime::W3C)
27
            )
28
        );
29 1
    }
30
31
    /**
32
     * @return Notification
33
     */
34
    public function notification(): Notification
35
    {
36
        return $this->notification;
37
    }
38
}
39