Passed
Push — master ( 0074b5...431277 )
by Alexander
02:14
created

BeforeRun::isPropagationStopped()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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
declare(strict_types=1);
3
4
namespace Yiisoft\Widget\Event;
5
6
use Psr\EventDispatcher\StoppableEventInterface;
7
use Yiisoft\Widget\Widget;
8
9
/**
10
 * BeforeRun event is raised right before executing a widget.
11
 */
12
class BeforeRun implements StoppableEventInterface
13
{
14
    private Widget $widget;
15
    private bool $stopPropagation = false;
16
17 3
    public function __construct(Widget $widget)
18
    {
19 3
        $this->widget = $widget;
20 3
    }
21
22
    public function stopPropagation(): void
23
    {
24
        $this->stopPropagation = true;
25
    }
26
27 3
    public function isPropagationStopped(): bool
28
    {
29 3
        return $this->stopPropagation;
30
    }
31
32
    public function getWidget(): Widget
33
    {
34
        return $this->widget;
35
    }
36
}
37