| @@ 262-271 (lines=10) @@ | ||
| 259 | * |
|
| 260 | * @return $this |
|
| 261 | */ |
|
| 262 | public function addHeader($header, $headerValue) |
|
| 263 | { |
|
| 264 | if (is_string($header) && is_string($headerValue)) { |
|
| 265 | $this->_config['headers'][$header] = $headerValue; |
|
| 266 | } else { |
|
| 267 | throw new InvalidException('Header must be a string'); |
|
| 268 | } |
|
| 269 | ||
| 270 | return $this; |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Remove a HTTP Header. |
|
| @@ 282-293 (lines=12) @@ | ||
| 279 | * |
|
| 280 | * @return $this |
|
| 281 | */ |
|
| 282 | public function removeHeader($header) |
|
| 283 | { |
|
| 284 | if (is_string($header)) { |
|
| 285 | if (array_key_exists($header, $this->_config['headers'])) { |
|
| 286 | unset($this->_config['headers'][$header]); |
|
| 287 | } |
|
| 288 | } else { |
|
| 289 | throw new InvalidException('Header must be a string'); |
|
| 290 | } |
|
| 291 | ||
| 292 | return $this; |
|
| 293 | } |
|
| 294 | ||
| 295 | /** |
|
| 296 | * Uses _bulk to send documents to the server. |
|