| Conditions | 4 | 
| Paths | 6 | 
| Total Lines | 29 | 
| Code Lines | 18 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 13 | public function fromCdbAddress(\CultureFeed_Cdb_Data_Address_PhysicalAddress $cdbAddress)  | 
            ||
| 14 |     { | 
            ||
| 15 | $requiredFields = [  | 
            ||
| 16 | 'street' => $cdbAddress->getStreet(),  | 
            ||
| 17 | 'zip code' => $cdbAddress->getZip(),  | 
            ||
| 18 | 'city' => $cdbAddress->getCity(),  | 
            ||
| 19 | 'country' => $cdbAddress->getCountry(),  | 
            ||
| 20 | ];  | 
            ||
| 21 | |||
| 22 | $missingFields = [];  | 
            ||
| 23 |         foreach ($requiredFields as $key => $requiredField) { | 
            ||
| 24 |             if (is_null($requiredField)) { | 
            ||
| 25 | $missingFields[] = $key;  | 
            ||
| 26 | }  | 
            ||
| 27 | }  | 
            ||
| 28 | |||
| 29 |         if (count($missingFields) > 0) { | 
            ||
| 30 |             $keys = implode(', ', $missingFields); | 
            ||
| 31 |             throw new \InvalidArgumentException('The given cdbxml address is missing a ' . $keys); | 
            ||
| 32 | }  | 
            ||
| 33 | |||
| 34 | |||
| 35 | return new Address(  | 
            ||
| 36 | new Street($cdbAddress->getStreet() . ' ' . $cdbAddress->getHouseNumber()),  | 
            ||
| 37 | new PostalCode($cdbAddress->getZip()),  | 
            ||
| 38 | new Locality($cdbAddress->getCity()),  | 
            ||
| 39 | Country::fromNative($cdbAddress->getCountry())  | 
            ||
| 40 | );  | 
            ||
| 41 | }  | 
            ||
| 42 | }  | 
            ||
| 43 |