/**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * @covers WindowsAzure\Blob\Models\Container::getProperties
  */
 public function testGetProperties()
 {
     // Setup
     $date = Utilities::rfc1123ToDateTime('Wed, 12 Aug 2009 20:39:39 GMT');
     $container = new Container();
     $expected = new ContainerProperties();
     $expected->setEtag('0x8CACB9BD7C1EEEC');
     $expected->setLastModified($date);
     $container->setProperties($expected);
     // Test
     $actual = $container->getProperties();
     // Assert
     $this->assertEquals($expected, $actual);
 }