BaseEvent   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 32
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getAsArray() 0 8 1
1
<?php declare(strict_types=1);
2
3
namespace ekinhbayar\GitAmp\Event;
4
5
use ekinhbayar\GitAmp\Presentation\Information;
6
use ekinhbayar\GitAmp\Presentation\Type;
7
use ekinhbayar\GitAmp\Presentation\Ring;
8
use ekinhbayar\GitAmp\Presentation\Sound\BaseSound;
9
10
class BaseEvent implements Event
11
{
12
    protected int $id;
13
14
    protected Type $type;
15
16
    protected Information $information;
17
18
    protected Ring $ring;
19
20
    protected BaseSound $sound;
21
22 23
    public function __construct(int $id, Type $type, Information $information, Ring $ring, BaseSound $sound)
23
    {
24 23
        $this->id          = $id;
25 23
        $this->type        = $type;
26 23
        $this->information = $information;
27 23
        $this->ring        = $ring;
28 23
        $this->sound       = $sound;
29 23
    }
30
31
    /**
32
     * @return array<string,mixed>
33
     */
34 21
    public function getAsArray(): array
35
    {
36
        return [
37 21
            'id'          => $this->id,
38 21
            'type'        => $this->type->getValue(),
39 21
            'information' => $this->information->getAsArray(),
40 21
            'ring'        => $this->ring->getAsArray(),
41 21
            'sound'       => $this->sound->getAsArray(),
42
        ];
43
    }
44
}
45