| Conditions | 3 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 133 | public static function fromApi(array $data): self |
||
| 134 | { |
||
| 135 | $geo = null; |
||
| 136 | $country = null; |
||
| 137 | |||
| 138 | if ($data['coords']) { |
||
| 139 | $geo = Geo::fromApi($data['coords']); |
||
| 140 | } |
||
| 141 | |||
| 142 | if ($data['country']) { |
||
| 143 | $country = Country::fromApi($data['country']); |
||
| 144 | } |
||
| 145 | |||
| 146 | return new self( |
||
| 147 | (int) $data['id'], |
||
| 148 | $data['name'], |
||
| 149 | $data['state'], |
||
| 150 | $data['stateCode'], |
||
| 151 | $country, |
||
| 152 | $geo |
||
| 153 | ); |
||
| 154 | } |
||
| 155 | } |
||
| 156 |