Added SoapHeader in SoapRequest

This commit is contained in:
Francis Besset
2011-09-04 23:42:03 +02:00
parent caeb484e19
commit 5790a89571
4 changed files with 104 additions and 5 deletions

View File

@ -20,12 +20,14 @@ class SoapRequest
protected $function;
protected $arguments;
protected $options;
protected $headers;
public function __construct($function = null, array $arguments = array(), array $options = array())
public function __construct($function = null, array $arguments = array(), array $options = array(), array $headers = array())
{
$this->function = $function;
$this->arguments = $arguments;
$this->options = $options;
$this->setHeaders($headers);
}
/**
@ -143,6 +145,42 @@ class SoapRequest
return $this;
}
/**
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* @param array $headers
*
* @return SoapRequest
*/
public function setHeaders(array $headers)
{
$this->headers = array();
foreach ($headers as $header) {
$this->addHeader($header);
}
return $this;
}
/**
* @param \SoapHeader $header
*
* @return SoapRequest
*/
public function addHeader(\SoapHeader $header)
{
$this->headers[] = $header;
return $this;
}
/**
* @param string The name of option
* @param mixed The value of option