| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | final class RegionCurrency |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @param array<string, array{ _from?: string, _to?: string, _tender?: string }> $data |
||
|
|
|||
| 9 | */ |
||
| 10 | public static function from(array $data): self |
||
| 11 | { |
||
| 12 | $code = key($data); |
||
| 13 | $properties = current($data); |
||
| 14 | |||
| 15 | assert(is_string($code)); |
||
| 16 | assert(is_array($properties)); |
||
| 17 | |||
| 18 | return new self( |
||
| 19 | code: $code, |
||
| 20 | from: $properties['_from'] ?? null, |
||
| 21 | to: $properties['_to'] ?? null, |
||
| 22 | tender: ($properties['_tender'] ?? null) != 'false', |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | private function __construct( |
||
| 32 | } |
||
| 33 | } |
||
| 34 |