Passed
Push — master ( 657f5c...767802 )
by Ekin
03:11
created

BaseEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getAsArray() 0 10 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 $id;
13
14
    protected $type;
15
16
    protected $information;
17
18
    protected $ring;
19
20
    protected $sound;
21
22 23
    public function __construct(int $id, Type $type, Information $information, Ring $ring, BaseSound $sound) {
23 23
        $this->id          = $id;
24 23
        $this->type        = $type;
25 23
        $this->information = $information;
26 23
        $this->ring        = $ring;
27 23
        $this->sound       = $sound;
28
    }
29
30 21
    public function getAsArray(): array
31
    {
32
        return [
33 21
            'id'          => $this->id,
34 21
            'type'        => $this->type->getValue(),
35 21
            'information' => $this->information->getAsArray(),
36 21
            'ring'        => $this->ring->getAsArray(),
37 21
            'sound'       => $this->sound->getAsArray(),
38
        ];
39
    }
40
}
41