for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Ivory Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/
namespace Ivory\HttpAdapter\Message;
/**
* @author GeLo <[email protected]>
trait MessageTrait
{
* @var array
private $parameters = [];
* @return array
public function getParameters()
return $this->parameters;
}
* @param string $name
* @return bool
public function hasParameter($name)
return isset($this->parameters[$name]);
* @return mixed
public function getParameter($name)
return $this->hasParameter($name) ? $this->parameters[$name] : null;
* @param mixed $value
* @return object
public function withParameter($name, $value)
$new = clone $this;
$new->parameters[$name] = $value;
return $new;
public function withAddedParameter($name, $value)
$new->parameters[$name] = $new->hasParameter($name)
? array_merge((array) $new->parameters[$name], (array) $value)
: $value;
public function withoutParameter($name)
unset($new->parameters[$name]);