src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php
protected function processArray(Parameter $param, &$value)
    {
        // Convert the node if it was meant to be an array
        if (!isset($value[0])) {
            // Collections fo nodes are sometimes wrapped in an additional array. For example:
            // <Items><Item><a>1</a></Item><Item><a>2</a></Item></Items> should become:
            // array('Items' => array(array('a' => 1), array('a' => 2))
            // Some nodes are not wrapped. For example: <Foo><a>1</a></Foo><Foo><a>2</a></Foo>
            // should become array('Foo' => array(array('a' => 1), array('a' => 2))
            if ($param->getItems() && isset($value[$param->getItems()->getWireName()])) {
                // Account for the case of a collection wrapping wrapped nodes: Items => Item[]
                $value = $value[$param->getItems()->getWireName()];
                // If the wrapped node only had one value, then make it an array of nodes
                if (!isset($value[0]) || !is_array($value)) {
                    $value = array($value);
                }
            } elseif (!empty($value)) {
                // Account for repeated nodes that must be an array: Foo => Baz, Foo => Baz, but only if the
                // value is set and not empty
                $value = array($value);
            }
        }

        foreach ($value as &$item) {
            $this->recursiveProcess($param->getItems(), $item);
        }
    }
protected function processArray(Parameter $param, &$value)
    {
        // Convert the node if it was meant to be an array
        if (!isset($value[0])) {
            // Collections fo nodes are sometimes wrapped in an additional array. For example:
            // <Items><Item><a>1</a></Item><Item><a>2</a></Item></Items> should become:
            // array('Items' => array(array('a' => 1), array('a' => 2))
            // Some nodes are not wrapped. For example: <Foo><a>1</a></Foo><Foo><a>2</a></Foo>
            // should become array('Foo' => array(array('a' => 1), array('a' => 2))
            if ($param->getItems() && isset($value[$param->getItems()->getWireName()])) {
                // Account for the case of a collection wrapping wrapped nodes: Items => Item[]
                $value = $value[$param->getItems()->getWireName()];
                // If the wrapped node only had one value, then make it an array of nodes
                if (!isset($value[0]) || !is_array($value)) {
                    $value = array($value);
                }
            } elseif (!empty($value)) {
                // Account for repeated nodes that must be an array: Foo => Baz, Foo => Baz, but only if the
                // value is set and not empty
                $value = array($value);
            }
        }

        foreach ($value as &$item) {
            $this->recursiveProcess($param->getItems(), $item);
        }
    }
protected function processArray ( Parameter $ param , & $ value ) { // Convert the node if it was meant to be an array if ( ! isset ( $ value [ 0 ] ) ) { // Collections fo nodes are sometimes wrapped in an additional array. For example: // <Items><Item><a>1</a></Item><Item><a>2</a></Item></Items> should become: // array('Items' => array(array('a' => 1), array('a' => 2)) // Some nodes are not wrapped. For example: <Foo><a>1</a></Foo><Foo><a>2</a></Foo> // should become array('Foo' => array(array('a' => 1), array('a' => 2)) if ( $ param -> getItems ( ) && isset ( $ value [ $ param -> getItems ( ) -> getWireName ( ) ] ) ) { // Account for the case of a collection wrapping wrapped nodes: Items => Item[] $ value = $ value [ $ param -> getItems ( ) -> getWireName ( ) ] ; // If the wrapped node only had one value, then make it an array of nodes if ( ! isset ( $ value [ 0 ] ) || ! is_array ( $ value ) ) { $ value = array ( $ value ) ; } } elseif ( ! empty ( $ value ) ) { // Account for repeated nodes that must be an array: Foo => Baz, Foo => Baz, but only if the // value is set and not empty $ value = array ( $ value ) ; } } foreach ( $ value as & $ item ) { $ this -> recursiveProcess ( $ param -> getItems ( ) , $ item ) ; } }
Process an array

@param Parameter $param API parameter being parsed
@param mixed     $value Value to process
Process an array