Extends
lithium\net\Message
Adds config values to the public properties when a new object is created.
Parameters
- array $config Configuration options : default value - `scheme`: http - `host`: localhost - `port`: null - `username`: null - `password`: null - `path`: null - `version`: 1.1 - `headers`: array - `body`: null
Source
public function __construct(array $config = array()) {
$defaults = array(
'scheme' => 'http',
'host' => 'localhost',
'port' => null,
'username' => null,
'password' => null,
'path' => null,
'protocol' => null,
'version' => '1.1',
'headers' => array(),
'body' => null
);
$config += $defaults;
parent::__construct($config);
if (strpos($this->host, '/') !== false) {
list($this->host, $this->path) = explode('/', $this->host, 2);
}
$this->path = str_replace('//', '/', "/{$this->path}");
$this->protocol = $this->protocol ?: "HTTP/{$this->version}";
}