예제 #1
0
 /**
  * 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();
     $result->setETag(Utilities::tryGetValueInsensitive(Resources::ETAG, $headers));
     if (Utilities::arrayKeyExistsInsensitive(Resources::LAST_MODIFIED, $headers)) {
         $lastModified = Utilities::tryGetValueInsensitive(Resources::LAST_MODIFIED, $headers);
         $result->setLastModified(Utilities::rfc1123ToDateTime($lastModified));
     }
     return $result;
 }
예제 #2
0
 /**
  * @covers MicrosoftAzure\Storage\Common\Internal\Utilities::tryGetValueInsensitive
  */
 public function testTryGetValueInsensitive()
 {
     // Setup
     $key = 'KEy';
     $value = 1;
     $array = array($key => $value);
     // Test
     $actual = Utilities::tryGetValueInsensitive('keY', $array);
     // Assert
     $this->assertEquals($value, $actual);
 }
 /**
  * Creates a StorageServiceSettings object from the given connection string.
  * 
  * @param string $connectionString The storage settings connection string.
  * 
  * @return StorageServiceSettings 
  */
 public static function createFromConnectionString($connectionString)
 {
     $tokenizedSettings = self::parseAndValidateKeys($connectionString);
     // Devstore case
     $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_useDevelopmentStorageSetting), self::optional(self::$_developmentStorageProxyUriSetting));
     if ($matchedSpecs) {
         $proxyUri = Utilities::tryGetValueInsensitive(Resources::DEVELOPMENT_STORAGE_PROXY_URI_NAME, $tokenizedSettings);
         return self::_getDevelopmentStorageAccount($proxyUri);
     }
     // Automatic case
     $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_defaultEndpointsProtocolSetting, self::$_accountNameSetting, self::$_accountKeySetting), self::optional(self::$_blobEndpointSetting, self::$_queueEndpointSetting, self::$_tableEndpointSetting));
     if ($matchedSpecs) {
         return self::_createStorageServiceSettings($tokenizedSettings, self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::BLOB_BASE_DNS_NAME), self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::QUEUE_BASE_DNS_NAME), self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::TABLE_BASE_DNS_NAME));
     }
     // Explicit case
     $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::atLeastOne(self::$_blobEndpointSetting, self::$_queueEndpointSetting, self::$_tableEndpointSetting), self::allRequired(self::$_accountNameSetting, self::$_accountKeySetting));
     if ($matchedSpecs) {
         return self::_createStorageServiceSettings($tokenizedSettings);
     }
     self::noMatch($connectionString);
 }