Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
89 | public static function fromApi(array $data): self |
||
90 | { |
||
91 | $images = []; |
||
92 | |||
93 | if (array_key_exists('image', $data)) { |
||
94 | foreach ((array) $data['image'] as $image) { |
||
95 | $images[] = new Image($image['#text']); |
||
96 | } |
||
97 | } |
||
98 | |||
99 | return new self( |
||
100 | $data['name'] ?? $data['#text'], |
||
101 | $data['mbid'] ?? null, |
||
102 | $images, |
||
103 | $data['url'] ?? null |
||
104 | ); |
||
105 | } |
||
106 | } |
||
107 |