From cb8e0c7ea6f30a2de6943c9457d4704dba044bdd Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Sat, 23 Feb 2013 18:53:23 -0800 Subject: [PATCH] Optimizing if statement when creating client requests --- src/Guzzle/Http/Client.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Guzzle/Http/Client.php b/src/Guzzle/Http/Client.php index b498506d..8c08335a 100644 --- a/src/Guzzle/Http/Client.php +++ b/src/Guzzle/Http/Client.php @@ -258,10 +258,10 @@ class Client extends AbstractHasDispatcher implements ClientInterface // 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; }