public static getAvailableServices ( ) : array | ||
return | array | Returns the list of available services looks like array(serviceName => className) |
public static function getAvailableServices()
{
if (!isset(self::$availableServices)) {
$ns = __NAMESPACE__ . '\\Services';
$iterator = new GlobIterator(__DIR__ . '/Services/*Service.php', FilesystemIterator::KEY_AS_FILENAME);
/* @var $item \SplFileInfo */
foreach ($iterator as $item) {
$class = $ns . '\\' . substr($iterator->key(), 0, -4);
if (get_parent_class($class) == $ns . '\\AbstractService') {
self::$availableServices[$class::getName()] = $class;
}
}
}
return self::$availableServices;
}
/** * @test */ public function testGetAvailableServices() { $avail = OpenStack::getAvailableServices(); $this->assertNotEmpty($avail); $this->assertInternalType('array', $avail); $this->assertArrayHasKey('servers', $avail); $this->assertArrayNotHasKey('abstract', $avail); }