| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 9 | public static function build(array $data): CryptoCurrenciesCollection |
|
| 15 | { |
||
| 16 | 9 | $result = []; |
|
| 17 | 9 | if (!empty($data)) |
|
| 18 | { |
||
| 19 | 9 | foreach ($data as $item) |
|
| 20 | { |
||
| 21 | 9 | if (!is_string($item)) |
|
| 22 | { |
||
| 23 | 3 | throw new \UnexpectedValueException('Not valid item'); |
|
| 24 | } |
||
| 25 | 6 | $result[] = new CryptoCurrencyObject($item); |
|
| 26 | } |
||
| 27 | } |
||
| 28 | 6 | return new CryptoCurrenciesCollection($result); |
|
| 29 | } |
||
| 31 |