Process filter from the request and apply over response to get the partial results

@param array $response
@return array response
350603
public function filter($response)
    {
        $filter = $this->_request->getParam(static::FILTER_PARAMETER);
        if (!is_string($filter)) {
            return $response;
        }
        $filterArray = $this->parse($filter);
        if ($filterArray === null) {
            return $response;
        }
        $partialResponse = $this->applyFilter($response, $filterArray);
        return $partialResponse;
    }
877236
protected function GetResultFormResponse($response)
    {
        $aNeededResponseParameterToCheck = array('ret_status' => '', 'ret_errormsg' => '', 'trxuser_id' => '', 'trx_amount' => '', 'trx_currency' => '', 'ret_authcode' => '', 'ret_trx_number' => '', 'ret_param_checksum' => '');
        preg_match('/<a href=".*'.self::URL_PARAMETER_NAME.'\\/(success|error)\?(.*)">/', $response, $aMatch);
        if (count($aMatch) > 2) {
            $aResponseParts = explode('&', $aMatch[2]);
            foreach ($aResponseParts as $sRepsponsePart) {
                $aResponseKeyValue = explode('=', $sRepsponsePart);
                if (2 == count($aResponseKeyValue) && array_key_exists($aResponseKeyValue[0], $aNeededResponseParameterToCheck)) {
                    $aNeededResponseParameterToCheck[$aResponseKeyValue[0]] = $aResponseKeyValue[1];
                }
            }
        }

        return $aNeededResponseParameterToCheck;
    }
853772
public function handleResponse($response) {

        // No filter has been applied to this request.
        // Standard request, instantiate a single object.
        if(empty($this->filter)) {
            return $this->instantiateEntity($response);
        }

        // Filter applied.
        // Instantiate an object for each result returned.
        else {
            return array_map(function ($object) {
                return $this->instantiateEntity($object);
            }, $response->data);
        }

    }
332829
protected function _formatResult($response) {
		$result = array();
		foreach ($this->fields as $local => $stripe) {
			if (is_array($stripe)) {
				foreach ($stripe as $obj => $field) {
					if (isset($response->$obj->$field)) {
						$result[$local] = $response->$obj->$field;
					}
				}
			} else {
				if (isset($response->$stripe)) {
					$result[$local] = $response->$stripe;
				}
			}
		}
		// if no local fields match, return the default stripe_id
		if (empty($result)) {
			$result['stripe_id'] = $response->id;
		}
		return $result;
	}
811069
protected function getReference(array $response)
    {
        $payments = Arr::get($response, 'payments');

        if (!$payments) {
            return Arr::get($response, 'preference_id');
        }

        $lastPayment = Arr::last($payments);

        return Arr::get($lastPayment, 'id');
    }
767871
protected function filterResponse($response)
    {
        $contentType = $response->getHeader('Content-Type');

        if (!$contentType || false === strpos($contentType, 'charset=')) {
            if (preg_match('/\<meta[^\>]+charset *= *["\']?([a-zA-Z\-0-9]+)/i', $response->getContent(), $matches)) {
                $headers = $response->getHeaders();
                $headers['Content-Type'] = $contentType.';charset='.$matches[1];

                $response = new Response($response->getContent(), $response->getStatus(), $headers);
            }
        }

        return parent::filterResponse($response);
    }
1107548
private function transformGenericSearchToData($response)
    {
        if ($response instanceof ActiveQueryInterface) {
            return $response->asArray(true)->all();
        } elseif ($response instanceof QueryInterface) {
            return $response->all();
        }
        
        return $response;
    }
1190344
protected function modifyResponse(array $response = array())
    {
        $this->url->discardChanges();
        if (preg_match('~github\.com/([^/]+)/([a-z0-9]+)~i', $this->url, $matches))
            $response['html'] = '<script type="text/javascript" src="https://gist.github.com/' . $matches['1'] . '/' . $matches['2'] . '.js"></script>';

        return $response;
    }
936061
private function processData(array $result)
    {
        $this->checkResponseStatus($result['http_code']);

        // Get decoded response data
        $responseJSON = $result['response'];

        $this->checkJsonError();

        $responseArr = json_decode($responseJSON, true);

        if (!isset($responseArr['token'])) {
            throw new ResponseException('Token key is missing', 404);
        }

        return $responseArr;
    }
150374
protected function parseResponse($response)
    {
        synapse()->tags->each(function ($tag) use (&$response) {
            $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag";
            $tagClass = new $class();

            $response = $tagClass->parse($response, $this->input);
        });

        return $response;
    }
978145
private function processHttpResponse($response)
    {
        if ($response === null) {
            return null;
        }

        switch ($this->fakeType) {
            case 'pngb64':
                $base64 = base64_encode($response->getBody());
                return 'data:image/png;base64,' . $base64;
            case 'object': // 'object' not supported yet, we return array instead.
            case 'array':
                return json_decode($response->getBody(), true);
            default:
                return $response->getBody()->__toString();
        }
    }
1243104
protected function parseLookupResponse(Response $response)
    {
        $responseData = $response->getBody();
        $responseObject = json_decode($responseData);
        $definitionsData = $responseObject->def;
        $definitions = [];
        foreach ($definitionsData as $definitionData) {
            $definitions[] = new DictionaryDefinition($definitionData);
        }
        return $definitions;
    }
1031597
protected function extractCompletions($response)
    {
        $aggregations = isset($response['aggregations']) ? $response['aggregations'] : [];

        return array_map(function ($option) {
            return $option['key'];
        }, $aggregations['autocomplete']['buckets']);
    }
1137806
protected function filterResponse(Response $response)
    {
        $event = new FilterResponseEvent($this->app, $response);
        $this->event_dispatcher->dispatch(DietcubeEvents::FILTER_RESPONSE, $event);

        return $this->finishRequest($event->getResponse());
    }
991517
private function processResponse(Response $response)
    {
        $response = $response->getBody()->getContents();
        $response = json_decode($response, true);

        return $response;
    }
171687
private function processResult(array $result)
    {
        $this->checkResponseStatus($result['http_code']);

        // Get decoded response data
        $responseArr = json_decode($result['response'], true);

        $this->checkJsonError();

        return $responseArr;
    }
211000
protected function handleResponse(Response $response)
    {
        $statusCode = $response->getStatusCode();

        switch ($statusCode) {
            case 401:
                $response = $this->processNotAuthorized();
                break;
        }

        return $response;
    }