| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | final class GetPortListParametersFactory implements ValueObjectFactoryInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param array $parameters |
||
| 13 | * @return GetPortListParameters |
||
| 14 | * @throws \Exception |
||
| 15 | */ |
||
| 16 | public static function createFromArray(array $parameters) : GetPortListParameters |
||
| 17 | { |
||
| 18 | $getPortListParameters = new GetPortListParameters($parameters['airlineCode']); |
||
| 19 | if (array_key_exists('languageCode', $parameters)) { |
||
| 20 | $getPortListParameters = $getPortListParameters->withLanguageCode($parameters['languageCode']); |
||
| 21 | } |
||
| 22 | return $getPortListParameters; |
||
| 23 | } |
||
| 24 | |||
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $json |
||
| 28 | * @return GetPortListParameters |
||
| 29 | * @throws InvalidArgumentException |
||
| 30 | * @throws \Exception |
||
| 31 | */ |
||
| 32 | public static function createFromJson(string $json) : GetPortListParameters |
||
| 41 | } |
||
| 42 | } |
||
| 43 |