* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE.md. */ namespace Phemail\Message; /** * Class Header */ class Header implements HeaderInterface { /** * @var string */ protected $value; /** * @var string[] */ protected $attributes = []; /** * {@inheritdoc} */ public function getValue() { return $this->value; } /** * @param string $value * @return static */ public function withValue($value) { $clone = clone $this; $clone->value = $value; return $clone; } /** * {@inheritdoc} */ public function getAttributes() { return $this->attributes; } /** * @param string $name * @param string $value * @return static */ public function withAttribute($name, $value) { $clone = clone $this; $clone->attributes[$name] = $value; return $clone; } /** * {@inheritdoc} */ public function getAttribute($name) { return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; } }