本文整理汇总了PHP中GenericHeader类的典型用法代码示例。如果您正苦于以下问题:PHP GenericHeader类的具体用法?PHP GenericHeader怎么用?PHP GenericHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fromString
/**
* Factory create UserAgentHeader from string representation.
*
* @param string $headerLine
*
* @return $this
*/
public static function fromString($headerLine)
{
list($fieldName, $fieldValue) = GenericHeader::splitHeaderLine($headerLine);
$fieldName = str_replace(array(' ', '_', '.'), '-', $fieldName);
GenericHeader::assertHeaderFieldName('User-Agent', $fieldName);
return new static($fieldValue);
}
开发者ID:borobudur-php,项目名称:borobudur-http,代码行数:14,代码来源:UserAgentHeader.php
示例2: fromString
/**
* @param string $headerLine
* @return HeaderInterface|static
* @throws InvalidArgumentException
*/
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'dkimsignature') {
throw new InvalidArgumentException('Invalid header line for DKIM-Signature string');
}
$header = new static($value);
return $header;
}
开发者ID:fastnloud,项目名称:zf2-dkim,代码行数:15,代码来源:Dkim.php
示例3: fromString
public static function fromString($headerLine)
{
$decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = GenericHeader::splitHeaderLine($decodedLine);
$header = new static($name, $value);
if ($decodedLine != $headerLine) {
$header->setEncoding('UTF-8');
}
return $header;
}
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:10,代码来源:GenericHeader.php
示例4: fromString
/**
* Create Age header from string
*
* @param string $headerLine
* @return Age
* @throws Exception\InvalidArgumentException
*/
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'age') {
throw new Exception\InvalidArgumentException('Invalid header line for Age string: "' . $name . '"');
}
$header->deltaSeconds = (int) $value;
return $header;
}
开发者ID:eltondias,项目名称:Relogio,代码行数:18,代码来源:Age.php
示例5: fromString
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'accept-ranges') {
throw new Exception\InvalidArgumentException('Invalid header line for Accept-Ranges string');
}
$header->rangeUnit = trim($value);
return $header;
}
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:11,代码来源:AcceptRanges.php
示例6: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (str_replace(array('_', ' ', '.'), '-', strtolower($name)) !== 'user-agent') {
throw new Exception\InvalidArgumentException('Invalid header line for User-Agent string: "' . $name . '"');
}
// @todo implementation details
$header = new static($value);
return $header;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:11,代码来源:UserAgent.php
示例7: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'message-id') {
throw new Exception\InvalidArgumentException('Invalid header line for Message-ID string');
}
$header = new static();
$header->setId($value);
return $header;
}
开发者ID:mindfeederllc,项目名称:openemr,代码行数:11,代码来源:MessageId.php
示例8: fromString
/**
* @param $headerLine
* @return Connection
* @throws Exception\InvalidArgumentException
*/
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'connection') {
throw new Exception\InvalidArgumentException('Invalid header line for Connection string: "' . $name . '"');
}
$header->setValue(trim($value));
return $header;
}
开发者ID:eltondias,项目名称:Relogio,代码行数:16,代码来源:Connection.php
示例9: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
$value = HeaderWrap::mimeDecodeValue($value);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'date') {
throw new Exception\InvalidArgumentException('Invalid header line for Date string');
}
$header = new static($value);
return $header;
}
开发者ID:KBO-Techo-Dev,项目名称:MagazinePro-zf25,代码行数:11,代码来源:Date.php
示例10: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'content-language') {
throw new Exception\InvalidArgumentException('Invalid header line for Content-Language string: "' . $name . '"');
}
// @todo implementation details
$header = new static($value);
return $header;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:11,代码来源:ContentLanguage.php
示例11: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'content-transfer-encoding') {
throw new Exception\InvalidArgumentException(sprintf('Invalid header line for Content-Transfer-Encoding string: "%s"', $name));
}
// @todo implementation details
$header = new static(strtolower($value));
return $header;
}
开发者ID:Flesh192,项目名称:magento,代码行数:11,代码来源:ContentTransferEncoding.php
示例12: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'proxy-authenticate') {
throw new Exception\InvalidArgumentException(sprintf('Invalid header line for Proxy-Authenticate string: "%s"', $name));
}
// @todo implementation details
$header = new static($value);
return $header;
}
开发者ID:Flesh192,项目名称:magento,代码行数:11,代码来源:ProxyAuthenticate.php
示例13: fromString
/**
* Creates a CacheControl object from a headerLine
*
* @param string $headerLine
* @throws Exception\InvalidArgumentException
* @return CacheControl
*/
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'cache-control') {
throw new Exception\InvalidArgumentException('Invalid header line for Cache-Control string: "' . $name . '"');
}
// @todo implementation details
$header->directives = static::parseValue($value);
return $header;
}
开发者ID:eltondias,项目名称:Relogio,代码行数:19,代码来源:CacheControl.php
示例14: fromString
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'transfer-encoding') {
throw new Exception\InvalidArgumentException('Invalid header line for Transfer-Encoding string: "' . $name . '"');
}
// @todo implementation details
$header->value = $value;
return $header;
}
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:12,代码来源:TransferEncoding.php
示例15: fromString
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'content-transfer-encoding') {
throw new Exception\InvalidArgumentException('Invalid header line for Content-Transfer-Encoding string');
}
$header = new static();
$header->setTransferEncoding($value);
return $header;
}
开发者ID:tillk,项目名称:vufind,代码行数:12,代码来源:ContentTransferEncoding.php
示例16: fromString
public static function fromString($headerLine)
{
list($fieldName, $fieldValue) = GenericHeader::splitHeaderLine($headerLine);
$fieldValue = HeaderWrap::mimeDecodeValue($fieldValue);
if (strpos($fieldValue, ',')) {
$headers = [];
foreach (explode(',', $fieldValue) as $multiValue) {
$headers[] = new static($fieldName, $multiValue);
}
return $headers;
}
return new static($fieldName, $fieldValue);
}
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:13,代码来源:GenericMultiHeader.php
示例17: fromString
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'mime-version') {
throw new Exception\InvalidArgumentException('Invalid header line for MIME-Version string');
}
// Check for version, and set if found
$header = new static();
if (preg_match('/^(?P<version>\\d+\\.\\d+)$/', $value, $matches)) {
$header->setVersion($matches['version']);
}
return $header;
}
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:14,代码来源:MimeVersion.php
示例18: fromString
public static function fromString($headerLine)
{
list($fieldName, $fieldValue) = GenericHeader::splitHeaderLine($headerLine);
if (strpos($fieldValue, ',')) {
$headers = array();
foreach (explode(',', $fieldValue) as $multiValue) {
$headers[] = new static($fieldName, $multiValue);
}
return $headers;
} else {
$header = new static($fieldName, $fieldValue);
return $header;
}
}
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:14,代码来源:GenericMultiHeader.php
示例19: fromString
/**
* Creates a CacheControl object from a headerLine
*
* @param string $headerLine
* @throws Exception\InvalidArgumentException
* @return CacheControl
*/
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'cache-control') {
throw new Exception\InvalidArgumentException(sprintf('Invalid header line for Cache-Control string: ""', $name));
}
$directives = static::parseValue($value);
// @todo implementation details
$header = new static();
foreach ($directives as $key => $value) {
$header->addDirective($key, $value);
}
return $header;
}
开发者ID:noppongsatorn,项目名称:VINVINserver,代码行数:22,代码来源:CacheControl.php
示例20: fromString
/**
* Create Retry-After header from string
*
* @param string $headerLine
* @return RetryAfter
* @throws Exception\InvalidArgumentException
*/
public static function fromString($headerLine)
{
$dateHeader = new static();
list($name, $date) = GenericHeader::splitHeaderLine($headerLine);
// check to ensure proper header type for this factory
if (strtolower($name) !== strtolower($dateHeader->getFieldName())) {
throw new Exception\InvalidArgumentException('Invalid header line for "' . $dateHeader->getFieldName() . '" header string');
}
if (is_numeric($date)) {
$dateHeader->setDeltaSeconds($date);
} else {
$dateHeader->setDate($date);
}
return $dateHeader;
}
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:22,代码来源:RetryAfter.php
注:本文中的GenericHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论