本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::getArray方法的具体用法?PHP Utilities::getArray怎么用?PHP Utilities::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsAzure\Common\Internal\Utilities
的用法示例。
在下文中一共展示了Utilities::getArray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates ListBlobResult object from parsed XML response.
*
* @param array $parsedResponse XML response parsed into array.
*
* @return ListBlobResult
*/
public static function create($parsedResponse)
{
$result = new ListContainersResult();
$result->_accountName = Utilities::tryGetKeysChainValue($parsedResponse, Resources::XTAG_ATTRIBUTES, Resources::XTAG_ACCOUNT_NAME);
$result->_prefix = Utilities::tryGetValue($parsedResponse, Resources::QP_PREFIX);
$result->_marker = Utilities::tryGetValue($parsedResponse, Resources::QP_MARKER);
$result->_nextMarker = Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
$result->_maxResults = Utilities::tryGetValue($parsedResponse, Resources::QP_MAX_RESULTS);
$result->_containers = array();
$rawContainer = array();
if (!empty($parsedResponse['Containers'])) {
$containersArray = $parsedResponse['Containers']['Container'];
$rawContainer = Utilities::getArray($containersArray);
}
foreach ($rawContainer as $value) {
$container = new Container();
$container->setName($value['Name']);
$container->setUrl($value['Url']);
$container->setMetadata(Utilities::tryGetValue($value, Resources::QP_METADATA, array()));
$properties = new ContainerProperties();
$date = $value['Properties']['Last-Modified'];
$date = Utilities::rfc1123ToDateTime($date);
$properties->setLastModified($date);
$properties->setETag($value['Properties']['Etag']);
$container->setProperties($properties);
$result->_containers[] = $container;
}
return $result;
}
示例2: __construct
/**
* Constructs new hosted service object.
*/
public function __construct()
{
$sources = func_get_args();
parent::__construct($sources);
$this->_deployments = array();
foreach ($sources as $source) {
$deployments = Utilities::tryGetKeysChainValue($source, Resources::XTAG_DEPLOYMENTS, Resources::XTAG_DEPLOYMENT);
if (!empty($deployments)) {
$this->_deployments = Utilities::createInstanceList(Utilities::getArray($deployments), 'WindowsAzure\\ServiceManagement\\Models\\Deployment');
}
}
}
示例3: _getEntries
/**
* Gets block entries from parsed response
*
* @param array $parsed HTTP response
* @param string $type Block type
*
* @return array
*/
private static function _getEntries($parsed, $type)
{
$entries = array();
if (is_array($parsed)) {
$rawEntries = array();
if (array_key_exists($type, $parsed) && is_array($parsed[$type]) && !empty($parsed[$type])) {
$rawEntries = Utilities::getArray($parsed[$type]['Block']);
}
foreach ($rawEntries as $value) {
$entries[base64_decode($value['Name'])] = $value['Size'];
}
}
return $entries;
}
示例4: create
/**
* Creates PeekMessagesResult object from parsed XML response.
*
* @param array $parsedResponse XML response parsed into array.
*
* @return WindowsAzure\Queue\Models\PeekMessagesResult.
*/
public static function create($parsedResponse)
{
$result = new PeekMessagesResult();
$queueMessages = array();
if (!empty($parsedResponse)) {
$rawMessages = Utilities::getArray($parsedResponse['QueueMessage']);
foreach ($rawMessages as $value) {
$message = WindowsAzureQueueMessage::createFromPeekMessages($value);
$queueMessages[] = $message;
}
}
$result->setQueueMessages($queueMessages);
return $result;
}
示例5: create
/**
* Creates new ListLocationsResult from parsed response body.
*
* @param array $parsed The parsed response body.
*
* @return ListLocationsResult
*/
public static function create($parsed)
{
$result = new ListLocationsResult();
$result->_locations = array();
$entries = array();
if (!empty($parsed)) {
$entries = Utilities::getArray($parsed[Resources::XTAG_LOCATION]);
}
foreach ($entries as $value) {
$location = new Location();
$location->setName(Utilities::tryGetValue($value, Resources::XTAG_NAME));
$location->setDisplayName(Utilities::tryGetValue($value, Resources::XTAG_DISPLAY_NAME));
$result->_locations[] = $location;
}
return $result;
}
示例6: create
/**
* Creates ListQueuesResult object from parsed XML response.
*
* @param array $parsedResponse XML response parsed into array.
*
* @return WindowsAzure\Queue\Models\ListQueuesResult.
*/
public static function create($parsedResponse)
{
$result = new ListQueuesResult();
$result->_prefix = Utilities::tryGetValue($parsedResponse, Resources::QP_PREFIX);
$result->_marker = Utilities::tryGetValue($parsedResponse, Resources::QP_MARKER);
$result->_nextMarker = Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
$result->_maxResults = Utilities::tryGetValue($parsedResponse, Resources::QP_MAX_RESULTS);
$result->_queues = array();
$rawQueues = array();
if (!empty($parsedResponse['Queues'])) {
$rawQueues = Utilities::getArray($parsedResponse['Queues']['Queue']);
}
foreach ($rawQueues as $value) {
$queue = new Queue($value['Name'], $value['Url']);
$queue->setMetadata(Utilities::tryGetValue($value, Resources::QP_METADATA, array()));
$result->_queues[] = $queue;
}
return $result;
}
示例7: create
/**
* Parses the given array into signed identifiers.
*
* @param string $publicAccess The container public access.
* @param array $parsed The parsed response into array representation.
*
* @return none
*/
public static function create($publicAccess, $parsed)
{
$result = new ContainerAcl();
$result->_publicAccess = $publicAccess;
$result->_signedIdentifiers = array();
if (!empty($parsed) && is_array($parsed['SignedIdentifier'])) {
$entries = $parsed['SignedIdentifier'];
$temp = Utilities::getArray($entries);
foreach ($temp as $value) {
$startString = urldecode($value['AccessPolicy']['Start']);
$expiryString = urldecode($value['AccessPolicy']['Expiry']);
$start = Utilities::convertToDateTime($startString);
$expiry = Utilities::convertToDateTime($expiryString);
$permission = $value['AccessPolicy']['Permission'];
$id = $value['Id'];
$result->addSignedIdentifier($id, $start, $expiry, $permission);
}
}
return $result;
}
示例8: create
/**
* Creates ListQueuesResult object from parsed XML response.
*
* @param array $parsedResponse XML response parsed into array.
*
* @return WindowsAzure\Queue\Models\ListQueuesResult.
*/
public static function create($parsedResponse)
{
$result = new ListQueuesResult();
$result->_accountName = Utilities::tryGetKeysChainValue($parsedResponse, Resources::XTAG_ATTRIBUTES, Resources::XTAG_ACCOUNT_NAME);
$result->_prefix = Utilities::tryGetValue($parsedResponse, Resources::QP_PREFIX);
$result->_marker = Utilities::tryGetValue($parsedResponse, Resources::QP_MARKER);
$result->_nextMarker = Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
$result->_maxResults = Utilities::tryGetValue($parsedResponse, Resources::QP_MAX_RESULTS);
$result->_queues = array();
$rawQueues = array();
if (!empty($parsedResponse['Queues'])) {
$rawQueues = Utilities::getArray($parsedResponse['Queues']['Queue']);
}
foreach ($rawQueues as $value) {
$queue = new Queue($value['Name'], $value['Url']);
$metadata = Utilities::tryGetValue($value, Resources::QP_METADATA);
$queue->setMetadata(is_null($metadata) ? array() : $metadata);
$result->_queues[] = $queue;
}
return $result;
}
示例9: create
/**
* Creates BlobProperties object from $parsed response in array representation
*
* @param array $headers HTTP response headers
* @param array $parsed parsed response in array format.
*
* @return ListPageBlobRangesResult
*/
public static function create($headers, $parsed)
{
$result = new ListPageBlobRangesResult();
$headers = array_change_key_case($headers);
$date = $headers[Resources::LAST_MODIFIED];
$date = Utilities::rfc1123ToDateTime($date);
$blobLength = intval($headers[Resources::X_MS_BLOB_CONTENT_LENGTH]);
$rawPageRanges = array();
if (!empty($parsed['PageRange'])) {
$parsed = array_change_key_case($parsed);
$rawPageRanges = Utilities::getArray($parsed['pagerange']);
}
$result->_pageRanges = array();
foreach ($rawPageRanges as $value) {
$result->_pageRanges[] = new PageRange(intval($value['Start']), intval($value['End']));
}
$result->setContentLength($blobLength);
$result->setEtag($headers[Resources::ETAG]);
$result->setLastModified($date);
return $result;
}
示例10: create
/**
* Creates ListBlobsResult object from parsed XML response.
*
* @param array $parsed XML response parsed into array.
*
* @return WindowsAzure\Blob\Models\ListBlobsResult.
*/
public static function create($parsed)
{
$result = new ListBlobsResult();
$result->_prefix = Utilities::tryGetValue($parsed, Resources::QP_PREFIX);
$result->_marker = Utilities::tryGetValue($parsed, Resources::QP_MARKER);
$result->_nextMarker = Utilities::tryGetValue($parsed, Resources::QP_NEXT_MARKER);
$result->_maxResults = intval(Utilities::tryGetValue($parsed, Resources::QP_MAX_RESULTS, 0));
$result->_delimiter = Utilities::tryGetValue($parsed, Resources::QP_DELIMITER);
$result->_blobs = array();
$result->_blobPrefixes = array();
$rawBlobs = array();
$rawBlobPrefixes = array();
if (is_array($parsed['Blobs']) && array_key_exists('Blob', $parsed['Blobs'])) {
$rawBlobs = Utilities::getArray($parsed['Blobs']['Blob']);
}
foreach ($rawBlobs as $value) {
$blob = new Blob();
$blob->setName($value['Name']);
$blob->setUrl($value['Url']);
$blob->setSnapshot(Utilities::tryGetValue($value, 'Snapshot'));
$blob->setProperties(BlobProperties::create(Utilities::tryGetValue($value, 'Properties')));
$blob->setMetadata(Utilities::tryGetValue($value, Resources::QP_METADATA, array()));
$result->_blobs[] = $blob;
}
if (is_array($parsed['Blobs']) && array_key_exists('BlobPrefix', $parsed['Blobs'])) {
$rawBlobPrefixes = Utilities::getArray($parsed['Blobs']['BlobPrefix']);
}
foreach ($rawBlobPrefixes as $value) {
$blobPrefix = new BlobPrefix();
$blobPrefix->setName($value['Name']);
$result->_blobPrefixes[] = $blobPrefix;
}
return $result;
}
示例11: testGetArrayWithEmptyValue
/**
* @covers WindowsAzure\Common\Internal\Utilities::getArray
*/
public function testGetArrayWithEmptyValue()
{
// Setup
$empty = Resources::EMPTY_STRING;
$expected = array();
// Test
$actual = Utilities::getArray($empty);
$this->assertEquals($expected, $actual);
}
示例12: create
/**
* Creates a new Deployment from parsed response body.
*
* @param array $parsed The parsed response body in array representation.
*
* @return Deployment
*/
public static function create($parsed)
{
$result = new Deployment();
$name = Utilities::tryGetValue($parsed, Resources::XTAG_NAME);
$label = Utilities::tryGetValue($parsed, Resources::XTAG_LABEL);
$url = Utilities::tryGetValue($parsed, Resources::XTAG_URL);
$locked = Utilities::tryGetValue($parsed, Resources::XTAG_LOCKED);
$rollbackAllowed = Utilities::tryGetValue($parsed, Resources::XTAG_ROLLBACK_ALLOWED);
$sdkVersion = Utilities::tryGetValue($parsed, Resources::XTAG_SDK_VERSION);
$inputEndpointList = Utilities::tryGetKeysChainValue($parsed, Resources::XTAG_INPUT_ENDPOINT_LIST, Resources::XTAG_INPUT_ENDPOINT);
$roleList = Utilities::tryGetKeysChainValue($parsed, Resources::XTAG_ROLE_LIST, Resources::XTAG_ROLE);
$roleInstanceList = Utilities::tryGetKeysChainValue($parsed, Resources::XTAG_ROLE_INSTANCE_LIST, Resources::XTAG_ROLE_INSTANCE);
$status = Utilities::tryGetValue($parsed, Resources::XTAG_STATUS);
$slot = Utilities::tryGetValue($parsed, Resources::XTAG_DEPLOYMENT_SLOT);
$privateId = Utilities::tryGetValue($parsed, Resources::XTAG_PRIVATE_ID);
$configuration = Utilities::tryGetValue($parsed, Resources::XTAG_CONFIGURATION);
$upgradeDomainCount = Utilities::tryGetValue($parsed, Resources::XTAG_UPGRADE_DOMAIN_COUNT);
$upgradeStatus = Utilities::tryGetValue($parsed, Resources::XTAG_UPGRADE_STATUS);
$result->setConfiguration($configuration);
$result->setLabel($label);
$result->setLocked(Utilities::toBoolean($locked));
$result->setName($name);
$result->setPrivateId($privateId);
$result->setRollbackAllowed(Utilities::toBoolean($rollbackAllowed));
$result->setSdkVersion($sdkVersion);
$result->setSlot($slot);
$result->setStatus($status);
$result->setUpgradeDomainCount(intval($upgradeDomainCount));
$result->setUpgradeStatus(UpgradeStatus::create($upgradeStatus));
$result->setUrl($url);
$result->setRoleInstanceList(Utilities::createInstanceList(Utilities::getArray($roleInstanceList), 'WindowsAzure\\ServiceManagement\\Models\\RoleInstance'));
$result->setRoleList(Utilities::createInstanceList(Utilities::getArray($roleList), 'WindowsAzure\\ServiceManagement\\Models\\Role'));
$result->setInputEndpointList(Utilities::createInstanceList(Utilities::getArray($inputEndpointList), 'WindowsAzure\\ServiceManagement\\Models\\InputEndpoint'));
return $result;
}