LoadedEventDTO   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
eloc 18
c 3
b 0
f 1
dl 0
loc 56
ccs 0
cts 11
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A new() 0 7 1
A getParameter() 0 3 1
A getChannelParameters() 0 3 1
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