Passed
Pull Request — master (#24)
by Alexander
02:20
created

BeforeSend::getMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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
    private bool $stopPropagation = false;
19
20 15
    public function __construct(MessageInterface $message)
21
    {
22 15
        $this->message = $message;
23 15
    }
24
25 1
    public function getMessage(): MessageInterface
26
    {
27 1
        return $this->message;
28
    }
29
30 2
    public function stopPropagation(): void
31
    {
32 2
        $this->stopPropagation = true;
33 2
    }
34
35 15
    public function isPropagationStopped(): bool
36
    {
37 15
        return $this->stopPropagation;
38
    }
39
}
40