BeforeSend   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 21
c 1
b 0
f 0
ccs 7
cts 7
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A stopPropagation() 0 3 1
A isPropagationStopped() 0 3 1
A __construct() 0 2 1
A getMessage() 0 3 1
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