Test Failed
Push — main ( 5af89f...c76fcf )
by Bingo
05:51
created

EventSubscriptionQueryValue   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 15
c 1
b 0
f 0
dl 0
loc 44
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getEventType() 0 3 1
A unserialize() 0 5 1
A setEventName() 0 3 1
A setEventType() 0 3 1
A serialize() 0 5 1
A __construct() 0 4 1
A getEventName() 0 3 1
1
<?php
2
3
namespace Jabe\Engine\Impl;
4
5
class EventSubscriptionQueryValue implements \Serializable
6
{
7
    protected $eventType;
8
    protected $eventName;
9
10
    public function __construct(string $eventName, string $eventType)
11
    {
12
        $this->eventName = $eventName;
13
        $this->eventType = $eventType;
14
    }
15
16
    public function serialize()
17
    {
18
        return json_encode([
19
            'eventName' => $this->eventName,
20
            'eventType' => $this->eventType
21
        ]);
22
    }
23
24
    public function unserialize($data)
25
    {
26
        $json = json_decode($data);
27
        $this->eventName = $json->eventName;
28
        $this->eventType = $json->eventType;
29
    }
30
31
    public function getEventType(): string
32
    {
33
        return $this->eventType;
34
    }
35
36
    public function setEventType(string $eventType): void
37
    {
38
        $this->eventType = $eventType;
39
    }
40
41
    public function getEventName(): string
42
    {
43
        return $this->eventName;
44
    }
45
46
    public function setEventName(string $eventName): void
47
    {
48
        $this->eventName = $eventName;
49
    }
50
}
51