| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | final class DefaultZipCodeFactory implements ZipCodeFactory |
||
| 10 | { |
||
| 11 | /** @inheritDoc */ |
||
| 12 | 5 | public function create(string $carrier, ?string $service, array $data): ZipCode |
|
| 13 | { |
||
| 14 | 5 | return new DefaultZipCode( |
|
| 15 | $carrier, |
||
| 16 | $service, |
||
| 17 | 5 | $data['zip'] ?? ($data['zip_start'] ?? null), |
|
| 18 | 5 | $data['zip_end'] ?? null, |
|
| 19 | 5 | $data['city'] ?? null, |
|
| 20 | 5 | $data['country'] ?? null, |
|
| 21 | 5 | (bool) ($data['1B'] ?? false), |
|
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** @inheritDoc */ |
||
| 26 | 5 | public function createIterator(string $carrier, ?string $service, ?string $country, array $data): ZipCodeIterator |
|
| 27 | { |
||
| 28 | 5 | return new DefaultZipCodeIterator($carrier, $service, $this->generate($carrier, $service, $country, $data)); |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param array<string,mixed> $data |
||
| 33 | * |
||
| 34 | * @return \Generator<\Inspirum\Balikobot\Model\ZipCode\ZipCode> |
||
| 35 | */ |
||
| 36 | 5 | private function generate(string $carrier, ?string $service, ?string $country, array $data): Generator |
|
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 |