EventConfig::getName()   A
last analyzed

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
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