| Conditions | 9 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function parseLine(string $value, array $parameters = []): NodeInterface |
||
| 12 | { |
||
| 13 | @list( |
||
| 14 | $postOfficeBox, |
||
| 15 | $extendedAddress, |
||
| 16 | $streetAddress, |
||
| 17 | $locality, |
||
| 18 | $region, |
||
| 19 | $postalCode, |
||
| 20 | $countryName |
||
| 21 | ) = explode(';', $value); |
||
| 22 | |||
| 23 | $address = new Address( |
||
| 24 | ($postOfficeBox !== '') ? $postOfficeBox : null, |
||
| 25 | ($extendedAddress !== '') ? $extendedAddress : null, |
||
| 26 | ($streetAddress !== '') ? $streetAddress : null, |
||
| 27 | ($locality !== '') ? $locality : null, |
||
| 28 | ($region !== '') ? $region : null, |
||
| 29 | ($postalCode !== '') ? $postalCode : null, |
||
| 30 | ($countryName !== '') ? $countryName : null |
||
| 31 | ); |
||
| 32 | |||
| 33 | if (array_key_exists(Type::getNode(), $parameters)) { |
||
| 34 | $address->setType($parameters[Type::getNode()]); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $address; |
||
| 38 | } |
||
| 40 |