本文整理汇总了PHP中Container::extractHeaderAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::extractHeaderAttributes方法的具体用法?PHP Container::extractHeaderAttributes怎么用?PHP Container::extractHeaderAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::extractHeaderAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractFromHeaders
/**
* Extract information from HTTP headers.
*
* This is used internally to set object properties from headers.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
protected function extractFromHeaders($response)
{
$this->setContentType($response->header('Content-Type', $this->contentType()));
$this->lastModified = strtotime($response->header('Last-Modified', 0));
$this->etag = $response->header('Etag', $this->etag);
$this->contentLength = (int) $response->header('Content-Length', 0);
$this->setDisposition($response->header('Content-Disposition', NULL));
$this->setEncoding($response->header('Content-Encoding', NULL));
// Reset the metadata, too:
$this->setMetadata(Container::extractHeaderAttributes($response->headers()));
return $this;
}
示例2: loadExtraData
/**
* Get missing fields.
*
* Not all containers come fully instantiated. This method is sometimes
* called to "fill in" missing fields.
*
* @retval HPCloud::Storage::ObjectStorage::Comtainer
* @return \HPCloud\Storage\ObjectStorage\Container
*/
protected function loadExtraData()
{
// If URL and token are empty, we are dealing with
// a local item that has not been saved, and was not
// created with Container::createContainer(). We treat
// this as an error condition.
if (empty($this->url) || empty($this->token)) {
throw new \HPCloud\Exception('Remote data cannot be fetched. Tokena and endpoint URL are required.');
}
// Do a GET on $url to fetch headers.
$client = \HPCloud\Transport::instance();
$headers = array('X-Auth-Token' => $this->token);
$response = $client->doRequest($this->url, 'GET', $headers);
// Get ACL.
$this->acl = ACL::newFromHeaders($response->headers());
// Update size and count.
$this->bytes = $response->header('X-Container-Bytes-Used', 0);
$this->count = $response->header('X-Container-Object-Count', 0);
// Get metadata.
$prefix = Container::CONTAINER_METADATA_HEADER_PREFIX;
$this->setMetadata(Container::extractHeaderAttributes($response->headers(), $prefix));
return $this;
}