src/Guzzle/Service/Command/OperationResponseParser.php
protected function visitResult(Parameter $model, CommandInterface $command, Response $response)
    {
        $foundVisitors = $result = $knownProps = array();
        $props = $model->getProperties();

        foreach ($props as $schema) {
            if ($location = $schema->getLocation()) {
                // Trigger the before method on the first found visitor of this type
                if (!isset($foundVisitors[$location])) {
                    $foundVisitors[$location] = $this->factory->getResponseVisitor($location);
                    $foundVisitors[$location]->before($command, $result);
                }
            }
        }

        // Visit additional properties when it is an actual schema
        if (($additional = $model->getAdditionalProperties()) instanceof Parameter) {
            $this->visitAdditionalProperties($model, $command, $response, $additional, $result, $foundVisitors);
        }

        // Apply the parameter value with the location visitor
        foreach ($props as $schema) {
            $knownProps[$schema->getName()] = 1;
            if ($location = $schema->getLocation()) {
                $foundVisitors[$location]->visit($command, $response, $schema, $result);
            }
        }

        // Remove any unknown and potentially unsafe top-level properties
        if ($additional === false) {
            $result = array_intersect_key($result, $knownProps);
        }

        // Call the after() method of each found visitor
        foreach ($foundVisitors as $visitor) {
            $visitor->after($command);
        }

        return $result;
    }
protected function visitResult(Parameter $model, CommandInterface $command, Response $response)
    {
        $foundVisitors = $result = $knownProps = array();
        $props = $model->getProperties();

        foreach ($props as $schema) {
            if ($location = $schema->getLocation()) {
                // Trigger the before method on the first found visitor of this type
                if (!isset($foundVisitors[$location])) {
                    $foundVisitors[$location] = $this->factory->getResponseVisitor($location);
                    $foundVisitors[$location]->before($command, $result);
                }
            }
        }

        // Visit additional properties when it is an actual schema
        if (($additional = $model->getAdditionalProperties()) instanceof Parameter) {
            $this->visitAdditionalProperties($model, $command, $response, $additional, $result, $foundVisitors);
        }

        // Apply the parameter value with the location visitor
        foreach ($props as $schema) {
            $knownProps[$schema->getName()] = 1;
            if ($location = $schema->getLocation()) {
                $foundVisitors[$location]->visit($command, $response, $schema, $result);
            }
        }

        // Remove any unknown and potentially unsafe top-level properties
        if ($additional === false) {
            $result = array_intersect_key($result, $knownProps);
        }

        // Call the after() method of each found visitor
        foreach ($foundVisitors as $visitor) {
            $visitor->after($command);
        }

        return $result;
    }
protected function visitResult ( Parameter $ model , CommandInterface $ command , Response $ response ) { $ foundVisitors = $ result = $ knownProps = array ( ) ; $ props = $ model -> getProperties ( ) ; foreach ( $ props as $ schema ) { if ( $ location = $ schema -> getLocation ( ) ) { // Trigger the before method on the first found visitor of this type if ( ! isset ( $ foundVisitors [ $ location ] ) ) { $ foundVisitors [ $ location ] = $ this -> factory -> getResponseVisitor ( $ location ) ; $ foundVisitors [ $ location ] -> before ( $ command , $ result ) ; } } } // Visit additional properties when it is an actual schema if ( ( $ additional = $ model -> getAdditionalProperties ( ) ) instanceof Parameter ) { $ this -> visitAdditionalProperties ( $ model , $ command , $ response , $ additional , $ result , $ foundVisitors ) ; } // Apply the parameter value with the location visitor foreach ( $ props as $ schema ) { $ knownProps [ $ schema -> getName ( ) ] = 1 ; if ( $ location = $ schema -> getLocation ( ) ) { $ foundVisitors [ $ location ] -> visit ( $ command , $ response , $ schema , $ result ) ; } } // Remove any unknown and potentially unsafe top-level properties if ( $ additional === false ) { $ result = array_intersect_key ( $ result , $ knownProps ) ; } // Call the after() method of each found visitor foreach ( $ foundVisitors as $ visitor ) { $ visitor -> after ( $ command ) ; } return $ result ; }
Perform transformations on the result array

@param Parameter        $model    Model that defines the structure
@param CommandInterface $command  Command that performed the operation
@param Response         $response Response received

@return array Returns the array of result data
Perform transformations on the result array