Event::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Thruster\Component\EventEmitter;
4
5
/**
6
 * Class Event
7
 *
8
 * @package Thruster\Component\EventEmitter
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class Event implements EventInterface
12
{
13
    /**
14
     * @var bool Whether no further event listeners should be triggered
15
     */
16
    protected $propagationStopped;
17
18
    /**
19
     * @var array
20
     */
21
    protected $params;
22
23
    /**
24
     * @param array $params
25
     */
26 13
    public function __construct(array $params = [])
27
    {
28 13
        $this->propagationStopped = false;
29
30 13
        $this->params = $params;
31 13
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 9
    public function isPropagationStopped() : bool
37
    {
38 9
        return $this->propagationStopped;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 1
    public function stopPropagation()
45
    {
46 1
        $this->propagationStopped = true;
47 1
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 4
    public function getParams() : array
53
    {
54 4
        return $this->params;
55
    }
56
}
57