Skip to content

Commit

Permalink
Optimizing if statement when creating client requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Feb 24, 2013
1 parent eb0d87f commit 62e31f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Client.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit 62e31f3

Please sign in to comment.