本文整理汇总了PHP中Scalr\Modules\PlatformFactory::isRackspace方法的典型用法代码示例。如果您正苦于以下问题:PHP PlatformFactory::isRackspace方法的具体用法?PHP PlatformFactory::isRackspace怎么用?PHP PlatformFactory::isRackspace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalr\Modules\PlatformFactory
的用法示例。
在下文中一共展示了PlatformFactory::isRackspace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adapter
/**
* Gets a new Instance of the adapter
*
* @param string|CloudCredentials|object $name The name of the adapter, or CloudCredentials entity, or cloud credentials data
*
* @return ApiEntityAdapter Returns the instance of cloud credentials adapter
*
* @throws ApiErrorException
*/
public function adapter($name, array $transform = null)
{
if (is_object($name)) {
//
$property = $name instanceof $this->entityClass ? static::$entityDescriminator : static::$objectDiscriminator;
$value = empty($transform) ? $name->{$property} : $transform[$name->{$property}];
switch (true) {
case PlatformFactory::isOpenstack($value, true):
$value = SERVER_PLATFORMS::OPENSTACK;
break;
case PlatformFactory::isCloudstack($value):
$value = SERVER_PLATFORMS::CLOUDSTACK;
break;
case PlatformFactory::isRackspace($value):
$value = SERVER_PLATFORMS::RACKSPACE;
break;
}
if (!isset(static::$inheritanceMap[$value])) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, "Unknown cloud '{$value}'");
}
$class = empty(static::$inheritanceMap) ? $value : static::$inheritanceMap[$value];
$name = empty(static::$inheritedNamespace) ? $class : static::$inheritedNamespace . "\\{$class}";
}
return parent::adapter($name);
}