本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities::rfc1123ToDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::rfc1123ToDateTime方法的具体用法?PHP Utilities::rfc1123ToDateTime怎么用?PHP Utilities::rfc1123ToDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsAzure\Common\Internal\Utilities
的用法示例。
在下文中一共展示了Utilities::rfc1123ToDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: create
/**
* Creates GetBlobMetadataResult from response headers.
*
* @param array $headers The HTTP response headers.
* @param array $metadata The blob metadata array.
*
* @return GetBlobMetadataResult
*/
public static function create($headers, $metadata)
{
$result = new GetBlobMetadataResult();
$date = $headers[Resources::LAST_MODIFIED];
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
$result->setEtag($headers[Resources::ETAG]);
$result->setMetadata(is_null($metadata) ? array() : $metadata);
return $result;
}
示例5: 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();
$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;
}
示例6: testSetLastModified
/**
* @covers WindowsAzure\Blob\Models\BlobProperties::setLastModified
* @covers WindowsAzure\Blob\Models\BlobProperties::getLastModified
*/
public function testSetLastModified()
{
// Setup
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
$properties = new BlobProperties();
$properties->setLastModified($expected);
// Test
$properties->setLastModified($expected);
// Assert
$this->assertEquals($expected, $properties->getLastModified());
}
示例7: testSetLastModified
/**
* @covers WindowsAzure\Blob\Models\CreateBlobPagesResult::setLastModified
* @covers WindowsAzure\Blob\Models\CreateBlobPagesResult::getLastModified
*/
public function testSetLastModified()
{
// Setup
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
$options = new CreateBlobPagesResult();
$options->setLastModified($expected);
// Test
$options->setLastModified($expected);
// Assert
$this->assertEquals($expected, $options->getLastModified());
}
示例8: testSetLastModified
/**
* @covers WindowsAzure\Blob\Models\ListBlobBlocksResult::setLastModified
* @covers WindowsAzure\Blob\Models\ListBlobBlocksResult::getLastModified
*/
public function testSetLastModified()
{
// Setup
$expected = Utilities::rfc1123ToDateTime('Sun, 25 Sep 2011 19:42:18 GMT');
$result = new ListBlobBlocksResult();
$result->setLastModified($expected);
// Test
$result->setLastModified($expected);
// Assert
$this->assertEquals($expected, $result->getLastModified());
}
示例9: create
/**
* Creates CreateFileRangeResult object from $parsed response in array
* representation
*
* @param array $headers HTTP response headers
*
* @return CreateFileRangeResult
*/
public static function create($headers)
{
$result = new CreateFileRangeResult();
$clean = array_change_key_case($headers);
$date = $clean[Resources::LAST_MODIFIED];
$date = Utilities::rfc1123ToDateTime($date);
$result->setETag($clean[Resources::ETAG]);
$result->setLastModified($date);
$result->setContentMD5(Utilities::tryGetValue($clean, Resources::CONTENT_MD5));
return $result;
}
示例10: create
/**
* Creates CreateBlobPagesResult object from $parsed response in array
* representation
*
* @param array $headers HTTP response headers
*
* @return CreateBlobPagesResult
*/
public static function create($headers)
{
$result = new CreateBlobPagesResult();
$clean = array_change_key_case($headers);
$date = $clean[Resources::LAST_MODIFIED];
$date = Utilities::rfc1123ToDateTime($date);
$result->setETag($clean[Resources::ETAG]);
$result->setLastModified($date);
$result->setContentMD5(Utilities::tryGetValue($clean, Resources::CONTENT_MD5));
$result->setSequenceNumber(intval(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_SEQUENCE_NUMBER)));
return $result;
}
示例11: create
/**
* Creates SetBlobPropertiesResult from response headers.
*
* @param array $headers response headers
*
* @return SetBlobPropertiesResult
*/
public static function create($headers)
{
$result = new SetBlobPropertiesResult();
$date = $headers[Resources::LAST_MODIFIED];
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
$result->setETag($headers[Resources::ETAG]);
if (array_key_exists(Resources::X_MS_BLOB_SEQUENCE_NUMBER, $headers)) {
$sNumber = $headers[Resources::X_MS_BLOB_SEQUENCE_NUMBER];
$result->setSequenceNumber(intval($sNumber));
}
return $result;
}
示例12: testCreateFromPeekMessages
/**
* @covers WindowsAzure\Queue\Models\WindowsAzureQueueMessage::createFromPeekMessages
*/
public function testCreateFromPeekMessages()
{
// Setup
$sample = TestResources::listMessagesSample();
$sample = $sample['QueueMessage'];
// Test
$actual = WindowsAzureQueueMessage::createFromPeekMessages($sample);
// Assert
$this->assertEquals($sample['MessageId'], $actual->getMessageId());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['InsertionTime']), $actual->getInsertionDate());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['ExpirationTime']), $actual->getExpirationDate());
$this->assertEquals(intval($sample['DequeueCount']), $actual->getDequeueCount());
$this->assertEquals($sample['MessageText'], $actual->getMessageText());
}
示例13: testCreateMultiple
/**
* @covers WindowsAzure\Queue\Models\PeekMessagesResult::create
*/
public function testCreateMultiple()
{
// Setup
$sample = TestResources::listMessagesMultipleMessagesSample();
// Test
$result = PeekMessagesResult::create($sample);
// Assert
$actual = $result->getQueueMessages();
$this->assertCount(2, $actual);
$this->assertEquals($sample['QueueMessage'][0]['MessageId'], $actual[0]->getMessageId());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['QueueMessage'][0]['InsertionTime']), $actual[0]->getInsertionDate());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['QueueMessage'][0]['ExpirationTime']), $actual[0]->getExpirationDate());
$this->assertEquals(intval($sample['QueueMessage'][0]['DequeueCount']), $actual[0]->getDequeueCount());
$this->assertEquals($sample['QueueMessage'][0]['MessageText'], $actual[0]->getMessageText());
$this->assertEquals($sample['QueueMessage'][1]['MessageId'], $actual[1]->getMessageId());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['QueueMessage'][1]['InsertionTime']), $actual[1]->getInsertionDate());
$this->assertEquals(Utilities::rfc1123ToDateTime($sample['QueueMessage'][1]['ExpirationTime']), $actual[1]->getExpirationDate());
$this->assertEquals(intval($sample['QueueMessage'][1]['DequeueCount']), $actual[1]->getDequeueCount());
$this->assertEquals($sample['QueueMessage'][1]['MessageText'], $actual[1]->getMessageText());
}
示例14: 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;
}
示例15: testWindowsAzureDateToDateTime
/**
* @covers WindowsAzure\Common\Internal\Utilities::rfc1123ToDateTime
*/
public function testWindowsAzureDateToDateTime()
{
// Setup
$expected = 'Fri, 16 Oct 2009 21:04:30 GMT';
// Test
$actual = Utilities::rfc1123ToDateTime($expected);
// Assert
$this->assertEquals($expected, $actual->format('D, d M Y H:i:s T'));
}