EventConfig   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getName() 0 3 1
A getOrigin() 0 3 1
A getExtraFilter() 0 3 1
A getRecipients() 0 3 1
1
<?php
2
3
namespace Smoren\EventRouter\Structs;
4
5
use Smoren\EventRouter\Interfaces\EventConfigInterface;
6
7
/**
8
 * EventConfig class
9
 */
10
class EventConfig implements EventConfigInterface
11
{
12
    /**
13
     * @var string event origin
14
     */
15
    protected string $origin;
16
    /**
17
     * @var string|null event name
18
     */
19
    protected ?string $name;
20
    /**
21
     * @var string[]|null event recipients
22
     */
23
    protected ?array $recipients;
24
    /**
25
     * @var callable|null extra filter
26
     */
27
    protected $extraFilter;
28
29
    /**
30
     * EventConfig constructor
31
     * @param string $origin
32
     * @param string|null $name
33
     * @param string[] $recipients
34
     * @param callable|null $extraFilter
35
     */
36 11
    public function __construct(
37
        string $origin,
38
        ?string $name = null,
39
        ?array $recipients = null,
40
        ?callable $extraFilter = null
41
    ) {
42 11
        $this->origin = $origin;
43 11
        $this->name = $name;
44 11
        $this->recipients = $recipients;
45 11
        $this->extraFilter = $extraFilter;
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     */
51 11
    public function getOrigin(): string
52
    {
53 11
        return $this->origin;
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59 11
    public function getName(): ?string
60
    {
61 11
        return $this->name;
62
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67 11
    public function getRecipients(): ?array
68
    {
69 11
        return $this->recipients;
70
    }
71
72
    /**
73
     * {@inheritDoc}
74
     */
75 11
    public function getExtraFilter(): ?callable
76
    {
77 11
        return $this->extraFilter;
78
    }
79
}
80