Permalink
Browse files

Optimizing if statement when creating client requests

  • Loading branch information...
1 parent eb0d87f commit 62e31f36b9778d654dba65bf7a9c9094ae7aeb6b @mtdowling mtdowling committed Feb 24, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 Client.php
View
@@ -258,10 +258,10 @@ public function createRequest($method = RequestInterface::GET, $uri = null, $hea
// If default headers are provided, then merge them into existing headers
// If a collision occurs, the header is completely replaced
if (count($this->defaultHeaders)) {
- if ($headers instanceof Collection) {
+ if (is_array($headers)) {
+ $headers = array_merge($this->defaultHeaders->getAll(), $headers);
+ } elseif ($headers instanceof Collection) {
$headers = array_merge($this->defaultHeaders->getAll(), $headers->getAll());
- } elseif (is_array($headers)) {
- $headers = array_merge($this->defaultHeaders->getAll(), $headers);
} else {
$headers = $this->defaultHeaders;
}

0 comments on commit 62e31f3

Please sign in to comment.