3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Http\Header
;
13 * Accept Ranges Header
15 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5
17 class AcceptRanges
implements HeaderInterface
20 protected $rangeUnit = null;
22 public static function fromString($headerLine)
24 $header = new static();
26 list($name, $value) = GenericHeader
::splitHeaderLine($headerLine);
28 // check to ensure proper header type for this factory
29 if (strtolower($name) !== 'accept-ranges') {
30 throw new Exception\
InvalidArgumentException('Invalid header line for Accept-Ranges string');
33 $header->rangeUnit
= trim($value);
38 public function getFieldName()
40 return 'Accept-Ranges';
43 public function getFieldValue()
45 return $this->getRangeUnit();
48 public function setRangeUnit($rangeUnit)
50 $this->rangeUnit
= $rangeUnit;
54 public function getRangeUnit()
56 return $this->rangeUnit
;
59 public function toString()
61 return 'Accept-Ranges: ' . $this->getFieldValue();