| Total Complexity | 8 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class MetadataUtils { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param $serviceName |
||
| 12 | * @param array $services |
||
| 13 | * @return array |
||
| 14 | * @throws ServiceNotFoundException |
||
| 15 | */ |
||
| 16 | public static function getService($serviceName, array $services) |
||
| 17 | { |
||
| 18 | if ($serviceName && isset($services[$serviceName])) { |
||
| 19 | return $services[$serviceName]; |
||
| 20 | } elseif ($serviceName) { |
||
| 21 | throw new ServiceNotFoundException("The service named $serviceName can not be found"); |
||
| 22 | } else { |
||
| 23 | return reset($services); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $portName |
||
| 29 | * @param array $service |
||
| 30 | * @return array |
||
| 31 | * @throws PortNotFoundException |
||
| 32 | */ |
||
| 33 | public static function getPort($portName, array $service) |
||
| 41 | } |
||
| 42 | } |
||
| 45 |