public function header()
{
if (func_num_args() == 1) {
$args = func_get_arg(0);
if (!is_array($args)) {
throw new RestAgentException("If you only pass one argument to set() it must be an array");
}
foreach ($args as $name => $value) {
$this->headers[$name] = $value;
}
return $this;
}
if (func_num_args() == 2) {
$name = func_get_arg(0);
$value = func_get_arg(1);
if (!is_string($name) || !(is_string($value) || is_numeric($value) || is_bool($value))) {
throw new RestAgentException("If you only pass two arguments to set(), first one must be a string and the second\n one must be: a string, a number, or a boolean");
}
$this->headers[$name] = $value;
return $this;
}
throw new RestAgentException("set() method only accepts either one or two arguments");
}