Test Failed
Pull Request — master (#24)
by Evgeniy
07:58
created

BeforeSend::getMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Mailer\Event;
6
7
use Psr\EventDispatcher\StoppableEventInterface;
8
use Yiisoft\Mailer\MessageInterface;
9
10
/**
11
 * BeforeSend event is triggered right before sending the message.
12
 *
13
 * @see \Yiisoft\Mailer\Mailer::beforeSend()
14
 */
15
final class BeforeSend implements StoppableEventInterface
16
{
17
    private MessageInterface $message;
18 9
    private bool $stopPropagation = false;
19
20 9
    public function __construct(MessageInterface $message)
21 9
    {
22
        $this->message = $message;
23
    }
24
25
    public function getMessage(): MessageInterface
26
    {
27
        return $this->message;
28
    }
29
30
    public function stopPropagation(): void
31 2
    {
32
        $this->stopPropagation = true;
33 2
    }
34 2
35
    public function isPropagationStopped(): bool
36 9
    {
37
        return $this->stopPropagation;
38 9
    }
39
}
40