Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class ClientInfoResponse |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | private $name; |
||
15 | |||
16 | /** |
||
17 | * @var array|Account[] |
||
18 | */ |
||
19 | private $accounts; |
||
20 | |||
21 | public function __construct(string $name, array $accounts) |
||
22 | { |
||
23 | $this->name = $name; |
||
24 | $this->accounts = $accounts; |
||
25 | } |
||
26 | |||
27 | public static function fromResponse(array $data): self |
||
28 | { |
||
29 | $accounts = array_map(function ($account) { |
||
30 | return Account::fromResponse($account); |
||
31 | }, $data['accounts']); |
||
32 | |||
33 | return new self($data['name'], $accounts); |
||
34 | } |
||
35 | |||
36 | public function name(): string |
||
37 | { |
||
38 | return $this->name; |
||
39 | } |
||
40 | |||
41 | public function accounts(): array |
||
44 | } |
||
45 | } |
||
46 |