diff --git a/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php b/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php index 6c0f116c..f024dd6b 100644 --- a/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php +++ b/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php @@ -117,13 +117,7 @@ class XmlVisitor extends AbstractResponseVisitor $name = $property->getName(); $sentAs = $property->getWireName(); if ($property->getData('xmlAttribute')) { - if (isset($value['@attributes'][$sentAs])) { - $value[$name] = $value['@attributes'][$sentAs]; - unset($value['@attributes'][$sentAs]); - if (empty($value['@attributes'])) { - unset($value['@attributes']); - } - } + $this->processXmlAttribute($property, $value); } elseif (isset($value[$sentAs])) { $this->recursiveProcess($property, $value[$sentAs]); if ($name != $sentAs) { @@ -137,4 +131,22 @@ class XmlVisitor extends AbstractResponseVisitor } } } + + /** + * Process an XML attribute property + * + * @param Parameter $property Property to process + * @param array $value Value to process and update + */ + protected function processXmlAttribute(Parameter $property, array &$value) + { + $sentAs = $property->getWireName(); + if (isset($value['@attributes'][$sentAs])) { + $value[$property->getName()] = $value['@attributes'][$sentAs]; + unset($value['@attributes'][$sentAs]); + if (empty($value['@attributes'])) { + unset($value['@attributes']); + } + } + } }