Passed
Push — master ( cf05d8...5fb5a4 )
by Teye
01:45 queued 16s
created

EmailForwarding::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Level23\Dynadot\Dto;
4
5
final class EmailForwarding implements DtoInterface
6
{
7
    public string $type;
8
9 1
    public function __construct(string $type = '')
10
    {
11 1
        $this->type = $type;
12
    }
13
14 1
    public static function fromArray(array $data): self
15
    {
16 1
        return new self(
17 1
            $data['type'] ?? ''
18 1
        );
19
    }
20
21
    /**
22
     * @return array<string, string>
23
     */
24
    public function jsonSerialize(): array
25
    {
26
        return [
27
            'type' => $this->type,
28
        ];
29
    }
30
}
31