for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Borobudur-Http package.
*
* (c) Hexacodelabs <http://hexacodelabs.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Borobudur\Http\Header;
/**
* @author Iqbal Maulana <[email protected]>
* @created 8/3/15
abstract class AbstractHeader implements HeaderInterface
{
use HeaderFactoryTrait;
* @var string
private $value;
* Constructor.
* @param string|null $value
public function __construct($value = null)
GenericHeader::assertEmptyHeaderFieldName(static::$headerName);
if (null !== $value) {
$this->set($value);
}
* Set header value.
* @param string $value
* @return $this
public function set($value)
GenericHeader::assertHeaderValue($value);
$this->value = $value;
return $this;
* Get header field name.
* @return string
public function getFieldName()
return static::$headerName;
* Get header field value.
* @return mixed
public function getFieldValue()
return $this->value;
* Cast header to string.
public function __toString()
return sprintf('%s: %s', $this->getFieldName(), $this->getFieldValue());