AccountInfoResult::fromArray()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
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