examples/src/ExampleGroupByQueries/ReferralsByCompanyGroupByResponseHandler.php
public function handleResponse($response)
    {
        $response = $response->json();

        if ( empty( $response ) ) {
            throw new \Exception('Unknown data source.');
        }

        $responseArray = array();

        foreach ( $response as $index => $chunk)
        {
            $timestamp = $chunk['timestamp'];
            $companyId = $chunk['event']['company_id'];
            $facilityId = $chunk['event']['facility_id'];
            $referrals = $chunk['event']['referral_count'];

            $responseObj = new \DruidFamiliar\ExampleResponseObjects\ExampleReferralByCompanyResponseObject(
                $companyId, $facilityId, $referrals, $timestamp
            );

            $responseArray[] = $responseObj;
        }

        return $responseArray;
    }
public function handleResponse($response)
    {
        $response = $response->json();

        if ( empty( $response ) ) {
            throw new \Exception('Unknown data source.');
        }

        $responseArray = array();

        foreach ( $response as $index => $chunk)
        {
            $timestamp = $chunk['timestamp'];
            $companyId = $chunk['event']['company_id'];
            $facilityId = $chunk['event']['facility_id'];
            $referrals = $chunk['event']['referral_count'];

            $responseObj = new \DruidFamiliar\ExampleResponseObjects\ExampleReferralByCompanyResponseObject(
                $companyId, $facilityId, $referrals, $timestamp
            );

            $responseArray[] = $responseObj;
        }

        return $responseArray;
    }
Hook function to handle response from server. Called with a PHP array of the JSON response from Druid.

This hook must return the response, whether changed or not, so that the rest of the system can continue with it.

@param Response $response
@return ExampleReferralByCompanyResponseObject