From 16474b70a920374ffea1baeea9630cb00a26c0f2 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Mon, 28 Jul 2014 01:24:36 +0200 Subject: [PATCH] zendframework/zf2#6137 - avoiding `elseif` where not needed --- src/Formatter/Xml.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Formatter/Xml.php b/src/Formatter/Xml.php index c8991407..783fe3e6 100644 --- a/src/Formatter/Xml.php +++ b/src/Formatter/Xml.php @@ -183,12 +183,18 @@ public function format($event) ) { if ($key == "message") { $value = $escaper->escapeHtml($value); - } elseif ($key == "extra" && empty($value)) { + } + + if ($key == "extra" && empty($value)) { continue; - } elseif ($key == "extra" && (is_array($value) || $value instanceof Traversable)) { + } + + if ($key == "extra" && (is_array($value) || $value instanceof Traversable)) { $elt->appendChild($this->buildElementTree($dom, $dom->createElement('extra'), $value)); + continue; } + $elt->appendChild(new DOMElement($key, (string) $value)); } }