BeforeSend::isPropagationStopped()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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