当前位置: 首页>>代码示例>>PHP>>正文


PHP Internal\Utilities类代码示例

本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities的典型用法代码示例。如果您正苦于以下问题:PHP Utilities类的具体用法?PHP Utilities怎么用?PHP Utilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Utilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Creates GetHostedServicePropertiesResult from parsed response.
  * 
  * @param array $parsed The parsed response in array representation.
  * 
  * @return GetHostedServicePropertiesResult 
  */
 public static function create($parsed)
 {
     $result = new GetHostedServicePropertiesResult();
     $properties = Utilities::tryGetValue($parsed, Resources::XTAG_HOSTED_SERVICE_PROPERTIES);
     $result->_hostedService = new HostedService($parsed, $properties);
     return $result;
 }
开发者ID:azt3k,项目名称:drupal-azure-blob,代码行数:14,代码来源:GetHostedServicePropertiesResult.php

示例2: computeCanonicalizedHeaders

 /**
  * Computes canonicalized headers for headers array.
  *
  * @param array $headers request headers.
  * 
  * @see Constructing the Canonicalized Headers String section at 
  *      http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx
  * 
  * @return array
  */
 protected function computeCanonicalizedHeaders($headers)
 {
     $canonicalizedHeaders = array();
     $normalizedHeaders = array();
     $validPrefix = Resources::X_MS_HEADER_PREFIX;
     if (is_null($normalizedHeaders)) {
         return $canonicalizedHeaders;
     }
     foreach ($headers as $header => $value) {
         // Convert header to lower case.
         $header = strtolower($header);
         // Retrieve all headers for the resource that begin with x-ms-,
         // including the x-ms-date header.
         if (Utilities::startsWith($header, $validPrefix)) {
             // Unfold the string by replacing any breaking white space
             // (meaning what splits the headers, which is \r\n) with a single
             // space.
             $value = str_replace("\r\n", ' ', $value);
             // Trim any white space around the colon in the header.
             $value = ltrim($value);
             $header = rtrim($header);
             $normalizedHeaders[$header] = $value;
         }
     }
     // Sort the headers lexicographically by header name, in ascending order.
     // Note that each header may appear only once in the string.
     ksort($normalizedHeaders);
     foreach ($normalizedHeaders as $key => $value) {
         $canonicalizedHeaders[] = $key . ':' . $value;
     }
     return $canonicalizedHeaders;
 }
开发者ID:isrealconsulting,项目名称:site,代码行数:42,代码来源:StorageAuthScheme.php

示例3: toArray

 /**
  * Converts the current object into ordered array representation.
  * 
  * @return array
  */
 protected function toArray()
 {
     $arr = parent::toArray();
     $order = array(Resources::XTAG_NAMESPACE, Resources::XTAG_SERVICE_NAME, Resources::XTAG_LABEL, Resources::XTAG_DESCRIPTION, Resources::XTAG_LOCATION, Resources::XTAG_AFFINITY_GROUP);
     $ordered = Utilities::orderArray($arr, $order);
     return $ordered;
 }
开发者ID:GabrielAnca,项目名称:azure-sdk-for-php,代码行数:12,代码来源:HostedService.php

示例4: create

 /**
  * Creates ListBlobResult object from parsed XML response.
  *
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return WindowsAzure\Blob\Models\ListBlobResult.
  */
 public static function create($parsedResponse)
 {
     $result = new ListContainersResult();
     $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;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:35,代码来源:ListContainersResult.php

示例5: encodeMimeMultipart

 /**
  * Given array of MIME parts in raw string, this function converts them into MIME
  * representation. 
  * 
  * @param array $bodyPartContents The MIME body parts.
  * 
  * @return array Returns array with two elements 'headers' and 'body' which
  * represents the MIME message.
  */
 public function encodeMimeMultipart($bodyPartContents)
 {
     $count = count($bodyPartContents);
     $mimeType = Resources::MULTIPART_MIXED_TYPE;
     $batchGuid = Utilities::getGuid();
     $batchId = sprintf('batch_%s', $batchGuid);
     $contentType1 = array('content_type' => "{$mimeType}");
     $changeSetGuid = Utilities::getGuid();
     $changeSetId = sprintf('changeset_%s', $changeSetGuid);
     $contentType2 = array('content_type' => "{$mimeType}; boundary={$changeSetId}");
     $options = array('encoding' => 'binary', 'content_type' => Resources::HTTP_TYPE);
     // Create changeset MIME part
     $changeSet = new \Mail_mimePart();
     for ($i = 0; $i < $count; $i++) {
         $changeSet->addSubpart($bodyPartContents[$i], $options);
     }
     // Encode the changeset MIME part
     $changeSetEncoded = $changeSet->encode($changeSetId);
     // Create the batch MIME part
     $batch = new \Mail_mimePart(Resources::EMPTY_STRING, $contentType1);
     // Add changeset encoded to batch MIME part
     $batch->addSubpart($changeSetEncoded['body'], $contentType2);
     // Encode batch MIME part
     $batchEncoded = $batch->encode($batchId);
     return $batchEncoded;
 }
开发者ID:GameWisp,项目名称:azure-sdk-for-php,代码行数:35,代码来源:MimeReaderWriter.php

示例6: create

 /**
  * Creates GetStorageServicePropertiesResult from parsed response.
  * 
  * @param array $parsed The parsed response in array representation.
  * 
  * @return GetStorageServicePropertiesResult 
  */
 public static function create($parsed)
 {
     $result = new GetStorageServicePropertiesResult();
     $properties = Utilities::tryGetValue($parsed, Resources::XTAG_STORAGE_SERVICE_PROPERTIES);
     $result->_storageService = new StorageService($parsed, $properties);
     return $result;
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:14,代码来源:GetStorageServicePropertiesResult.php

示例7: create

 /**
  * Creates WrapAccesTokenResult object from parsed XML response.
  *
  * @param array $response The get WRAP access token response.
  * 
  * @return WindowsAzure\ServiceBus\Internal\WrapAccessTokenResult.
  */
 public static function create($response)
 {
     $wrapAccessTokenResult = new self();
     parse_str($response, $parsedResponse);
     $wrapAccessTokenResult->setAccessToken(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN));
     $wrapAccessTokenResult->setExpiresIn(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN));
     return $wrapAccessTokenResult;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:15,代码来源:WrapAccessTokenResult.php

示例8: create

 /**
  * Creates GetBlobResult from getBlob call.
  * 
  * @param array  $headers  The HTTP response headers.
  * @param string $body     The response body.
  * @param array  $metadata The blob metadata.
  * 
  * @return GetBlobResult
  */
 public static function create($headers, $body, $metadata)
 {
     $result = new GetBlobResult();
     $result->setContentStream(Utilities::stringToStream($body));
     $result->setProperties(BlobProperties::create($headers));
     $result->setMetadata(is_null($metadata) ? array() : $metadata);
     return $result;
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:17,代码来源:GetBlobResult.php

示例9: create

 /**
  * Create InsertEntityResult object from HTTP response parts.
  * 
  * @param string            $body           The HTTP response body.
  * @param array             $headers        The HTTP response headers.
  * @param IAtomReaderWriter $atomSerializer The atom reader and writer.
  * 
  * @return \WindowsAzure\Table\Models\InsertEntityResult
  * 
  * @static
  */
 public static function create($body, $headers, $atomSerializer)
 {
     $result = new InsertEntityResult();
     $entity = $atomSerializer->parseEntity($body);
     $entity->setETag(Utilities::tryGetValue($headers, Resources::ETAG));
     $result->setEntity($entity);
     return $result;
 }
开发者ID:mat33470,项目名称:PFA,代码行数:19,代码来源:InsertEntityResult.php

示例10: toArray

 /**
  * Converts the current object into ordered array representation.
  * 
  * @return array
  */
 protected function toArray()
 {
     $arr = parent::toArray();
     $order = array(Resources::XTAG_NAMESPACE, Resources::XTAG_NAME, Resources::XTAG_LABEL, Resources::XTAG_DESCRIPTION, Resources::XTAG_LOCATION);
     Utilities::addIfNotEmpty(Resources::XTAG_NAME, $this->getName(), $arr);
     $ordered = Utilities::orderArray($arr, $order);
     return $ordered;
 }
开发者ID:pankajadhyapak,项目名称:um_new,代码行数:13,代码来源:AffinityGroup.php

示例11: create

 /**
  * Creates CopyBlobResult object from the response of the copy blob request.
  * 
  * @param array $headers The HTTP response headers in array representation.
  * 
  * @return CopyBlobResult
  */
 public static function create($headers)
 {
     $result = new CopyBlobResult();
     $headerWithLowerCaseKey = array_change_key_case($headers);
     $result->setEtag($headerWithLowerCaseKey[Resources::ETAG]);
     $result->setLastModified(Utilities::rfc1123ToDateTime($headerWithLowerCaseKey[Resources::LAST_MODIFIED]));
     return $result;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:15,代码来源:CopyBlobResult.php

示例12: create

 /**
  * Creates new QueryTablesResult object
  * 
  * @param array $headers The HTTP response headers
  * @param array $entries The table entriess
  * 
  * @return \WindowsAzure\Table\Models\QueryTablesResult 
  */
 public static function create($headers, $entries)
 {
     $result = new QueryTablesResult();
     $headers = array_change_key_case($headers);
     $result->setNextTableName(Utilities::tryGetValue($headers, Resources::X_MS_CONTINUATION_NEXTTABLENAME));
     $result->setTables($entries);
     return $result;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:16,代码来源:QueryTablesResult.php

示例13: create

 /**
  * Creates SetBlobMetadataResult from response headers.
  * 
  * @param array $headers response headers
  * 
  * @return SetBlobMetadataResult
  */
 public static function create($headers)
 {
     $result = new SetBlobMetadataResult();
     $date = $headers[Resources::LAST_MODIFIED];
     $result->setLastModified(Utilities::rfc1123ToDateTime($date));
     $result->setETag($headers[Resources::ETAG]);
     return $result;
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:15,代码来源:SetBlobMetadataResult.php

示例14: create

 /**
  * Creates new ListStorageServicesResult from parsed response body.
  * 
  * @param array $parsed The parsed response body.
  * 
  * @return ListStorageServicesResult
  */
 public static function create($parsed)
 {
     $result = new ListStorageServicesResult();
     $rowStorageServices = Utilities::tryGetArray(Resources::XTAG_STORAGE_SERVICE, $parsed);
     foreach ($rowStorageServices as $rowStorageService) {
         $result->_storageServices[] = new StorageService($rowStorageService);
     }
     return $result;
 }
开发者ID:GabrielAnca,项目名称:azure-sdk-for-php,代码行数:16,代码来源:ListStorageServicesResult.php

示例15: create

 /**
  * Creates new GetStorageServiceKeysResult object from parsed response.
  * 
  * @param array $parsed The HTTP parsed response into array representation.
  * 
  * @return GetStorageServiceKeysResult
  */
 public static function create($parsed)
 {
     $result = new GetStorageServiceKeysResult();
     $keys = Utilities::tryGetValue($parsed, Resources::XTAG_STORAGE_SERVICE_KEYS);
     $result->_url = Utilities::tryGetValue($parsed, Resources::XTAG_URL);
     $result->_primary = Utilities::tryGetValue($keys, Resources::XTAG_PRIMARY);
     $result->_secondary = Utilities::tryGetValue($keys, Resources::XTAG_SECONDARY);
     return $result;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:16,代码来源:GetStorageServiceKeysResult.php


注:本文中的WindowsAzure\Common\Internal\Utilities类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。