Beispiel #1
0
 /**
  * Creates BlobProperties object from $parsed response in array representation
  * 
  * @param array $parsed parsed response in array format.
  * 
  * @return BlobProperties
  */
 public static function create($parsed)
 {
     $result = new BlobProperties();
     $clean = array_change_key_case($parsed);
     $date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);
     $result->setBlobType(Utilities::tryGetValue($clean, 'blobtype'));
     $result->setContentLength(intval($clean[Resources::CONTENT_LENGTH]));
     $result->setETag(Utilities::tryGetValue($clean, Resources::ETAG));
     if (!is_null($date)) {
         $date = Utilities::rfc1123ToDateTime($date);
         $result->setLastModified($date);
     }
     $result->setLeaseStatus(Utilities::tryGetValue($clean, 'leasestatus'));
     $result->setLeaseStatus(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_STATUS, $result->getLeaseStatus()));
     $result->setSequenceNumber(intval(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_SEQUENCE_NUMBER)));
     $result->setContentRange(Utilities::tryGetValue($clean, Resources::CONTENT_RANGE));
     $result->setCacheControl(Utilities::tryGetValue($clean, Resources::CACHE_CONTROL));
     $result->setBlobType(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_TYPE, $result->getBlobType()));
     $result->setContentEncoding(Utilities::tryGetValue($clean, Resources::CONTENT_ENCODING));
     $result->setContentLanguage(Utilities::tryGetValue($clean, Resources::CONTENT_LANGUAGE));
     $result->setContentMD5(Utilities::tryGetValue($clean, Resources::CONTENT_MD5));
     $result->setContentType(Utilities::tryGetValue($clean, Resources::CONTENT_TYPE));
     return $result;
 }
 /**
  * @covers WindowsAzure\Blob\Models\BlobProperties::setLeaseStatus
  * @covers WindowsAzure\Blob\Models\BlobProperties::getLeaseStatus
  */
 public function testSetLeaseStatus()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $properties = new BlobProperties();
     $properties->setLeaseStatus($expected);
     // Test
     $properties->setLeaseStatus($expected);
     // Assert
     $this->assertEquals($expected, $properties->getLeaseStatus());
 }