AccountInfoResult   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 23
ccs 6
cts 9
cp 0.6667
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A jsonSerialize() 0 4 1
A fromArray() 0 4 2
1
<?php
2
3
namespace Level23\Dynadot\Dto;
4
5
final class AccountInfoResult implements DtoInterface
6
{
7
    public AccountInfo $accountInfo;
8
9 1
    public function __construct(AccountInfo $accountInfo)
10
    {
11 1
        $this->accountInfo = $accountInfo;
12
    }
13
14 1
    public static function fromArray(array $data): self
15
    {
16 1
        return new self(
17 1
            isset($data['account_info']) ? AccountInfo::fromArray($data['account_info']) : new AccountInfo()
18 1
        );
19
    }
20
21
    /**
22
     * @return array<string, mixed>
23
     */
24
    public function jsonSerialize(): array
25
    {
26
        return [
27
            'account_info' => $this->accountInfo->jsonSerialize(),
28
        ];
29
    }
30
}
31