Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
50.00% |
2 / 4 |
CRAP | |
77.78% |
7 / 9 |
ContentType | |
0.00% |
0 / 1 |
|
50.00% |
2 / 4 |
5.27 | |
77.78% |
7 / 9 |
fromString($headerLine) | |
0.00% |
0 / 1 |
2.02 | |
83.33% |
5 / 6 |
|||
getFieldName() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getFieldValue() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
toString() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
<?php | |
/** | |
* Zend Framework (http://framework.zend.com/) | |
* | |
* @link http://github.com/zendframework/zf2 for the canonical source repository | |
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) | |
* @license http://framework.zend.com/license/new-bsd New BSD License | |
*/ | |
namespace Zend\Http\Header; | |
/** | |
* @throws Exception\InvalidArgumentException | |
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 | |
*/ | |
class ContentType implements HeaderInterface | |
{ | |
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) !== 'content-type') { | |
throw new Exception\InvalidArgumentException('Invalid header line for Content-Type string: "' . $name . '"'); | |
} | |
// @todo implementation details | |
$header->value = $value; | |
return $header; | |
} | |
public function getFieldName() | |
{ | |
return 'Content-Type'; | |
} | |
public function getFieldValue() | |
{ | |
return $this->value; | |
} | |
public function toString() | |
{ | |
return 'Content-Type: ' . $this->getFieldValue(); | |
} | |
} |