本文整理汇总了PHP中GenericHeader类的典型用法代码示例。如果您正苦于以下问题:PHP GenericHeader类的具体用法?PHP GenericHeader怎么用?PHP GenericHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}