src/Acquia/Rest/Collection.php
public function getIterator()
    {
        $array = $this->getArrayCopy();

        // Is the collection nested in the array?
        if (isset($this->collectionProperty)) {

            // Locate the collection in the response.
            $collectionFound = false;
            $property = NULL;
            foreach ((array) $this->collectionProperty as $property) {
                if (isset($array[$property])) {
                    $collectionFound = true;
                    break;
                }
            }

            if (!$collectionFound) {
                throw new \OutOfBoundsException('Collection not found in response');
            }

            $array = $array[$property];
        }

        // Build the collection.
        $collection = array();
        foreach ($array as $item) {
            $element = new $this->elementClass($item);
            $collection[(string) $element] = $element;
        }

        return new \ArrayObject($collection);
    }
public function getIterator()
    {
        $array = $this->getArrayCopy();

        // Is the collection nested in the array?
        if (isset($this->collectionProperty)) {

            // Locate the collection in the response.
            $collectionFound = false;
            $property = NULL;
            foreach ((array) $this->collectionProperty as $property) {
                if (isset($array[$property])) {
                    $collectionFound = true;
                    break;
                }
            }

            if (!$collectionFound) {
                throw new \OutOfBoundsException('Collection not found in response');
            }

            $array = $array[$property];
        }

        // Build the collection.
        $collection = array();
        foreach ($array as $item) {
            $element = new $this->elementClass($item);
            $collection[(string) $element] = $element;
        }

        return new \ArrayObject($collection);
    }
public function getIterator ( ) { $ array = $ this -> getArrayCopy ( ) ; // Is the collection nested in the array? if ( isset ( $ this -> collectionProperty ) ) { // Locate the collection in the response. $ collectionFound = false ; $ property = NULL ; foreach ( ( array ) $ this -> collectionProperty as $ property ) { if ( isset ( $ array [ $ property ] ) ) { $ collectionFound = true ; break ; } } if ( ! $ collectionFound ) { throw new \ OutOfBoundsException ( 'Collection not found in response' ) ; } $ array = $ array [ $ property ] ; } // Build the collection. $ collection = array ( ) ; foreach ( $ array as $ item ) { $ element = new $ this -> elementClass ( $ item ) ; $ collection [ ( string ) $ element ] = $ element ; } return new \ ArrayObject ( $ collection ) ; }
Keys the array of objects by their identifier, constructs and returns and
array object.

When the object is cast to a string, its unique identifier is returned.

@return \ArrayObject

@throws \OutOfBoundsException

@see \Acquia\Rest\Element::__toString()
Keys the array of objects by their identifier constructs and returns and array object .