LoadedEventDTO::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 4
crap 2
1
<?php
2
3
namespace MallardDuck\DynamicEcho\Loader;
4
5
use MallardDuck\DynamicEcho\Channels\AbstractChannelParameters;
6
7
class LoadedEventDTO
8
{
9
    public string $eventName;
10
    public string $fullEventName;
11
    public string $jsEventCallback;
12
13
    /**
14
     * @var AbstractChannelParameters
15
     */
16
    private AbstractChannelParameters $channelParameters;
17
18
    /**
19
     * @param string                    $eventName
20
     * @param string                    $fullEventName
21
     * @param string                    $jsEventCallback
22
     * @param AbstractChannelParameters $channelParameters
23
     *
24
     * @return LoadedEventDTO
25
     */
26
    public static function new(
27
        string $eventName,
28
        string $fullEventName,
29
        string $jsEventCallback,
30
        AbstractChannelParameters $channelParameters
31
    ): LoadedEventDTO {
32
        return new self($eventName, $fullEventName, $jsEventCallback, $channelParameters);
33
    }
34
35
    /**
36
     * LoadedEventDTO constructor.
37
     *
38
     * @param string                    $eventName
39
     * @param string                    $fullEventName
40
     * @param string                    $jsEventCallback
41
     * @param AbstractChannelParameters $channelParameters
42
     */
43
    public function __construct(
44
        string $eventName,
45
        string $fullEventName,
46
        string $jsEventCallback,
47
        AbstractChannelParameters $channelParameters
48
    ) {
49
        $this->eventName = $eventName;
50
        $this->fullEventName = $fullEventName;
51
        $this->jsEventCallback = $jsEventCallback;
52
        $this->channelParameters = $channelParameters;
53
    }
54
55
    public function getChannelParameters(): AbstractChannelParameters
56
    {
57
        return $this->channelParameters;
58
    }
59
60
    public function getParameter(string $identifierKey)
61
    {
62
        return $this->channelParameters->{$identifierKey};
63
    }
64
}
65