Completed
Push — master ( 948520...165aa8 )
by Aurimas
14:17
created

Event   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 46
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A isPropagationStopped() 0 4 1
A stopPropagation() 0 4 1
A getParams() 0 4 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 1
    public function isPropagationStopped() : bool
37
    {
38 1
        return $this->propagationStopped;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 9
    public function stopPropagation()
45
    {
46 9
        $this->propagationStopped = true;
47 9
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 4
    public function getParams() : array
53
    {
54 4
        return $this->params;
55
    }
56
}
57