Takes responses for this field type and extracts all the text components

@param  array $aResponses The array of responses from ResponseAnswer

@return array
546556
public function getStatsTextData($aResponses)
    {
        $aOut     = [];
        $aStrings = [];

        foreach ($aResponses as $oResponse) {
            if (!empty($oResponse->text)) {
                if (!array_key_exists($oResponse->text, $aStrings)) {
                    $aStrings[$oResponse->text] = 0;
                }
                $aStrings[$oResponse->text]++;
            }
        }

        foreach ($aStrings as $sString => $iCount) {
            if ($iCount > 1) {
                $sString .= ' <span class="count" title="This item repeats ' . $iCount . ' times">' . $iCount . '</span>';
            }
            $aOut[] = $sString;
        }

        return $aOut;
    }
626994
private function parseResponseHeaders($raw_response_headers)
    {
        $response_header_array = explode("\r\n\r\n", $raw_response_headers);
        $response_header  = '';
        for ($i = count($response_header_array) - 1; $i >= 0; $i--) {
            if (stripos($response_header_array[$i], 'HTTP/') === 0) {
                $response_header = $response_header_array[$i];
                break;
            }
        }

        $response_headers = new CaseInsensitiveArray();
        list($first_line, $headers) = $this->parseHeaders($response_header);
        $response_headers['Status-Line'] = $first_line;
        foreach ($headers as $key => $value) {
            $response_headers[$key] = $value;
        }
        return $response_headers;
    }
448481
public function getResponseHeaders() {
    $headerStrings = headers_list();
    header_remove();
    $headers = [];
    foreach ($headerStrings as $header) {
      list($name, $value) = explode(':', $header, 2);
      $headers[trim($name)] = trim($value);
    }
    return $headers;
  }
381943
protected function parseGetLanguagesResponse(Response $response)
    {
        $responseBody = $response->getBody();
        $responseData = json_decode($responseBody);
        $languages = [];
        foreach ($responseData as $language) {
            $translation = explode('-', $language);
            $from = $translation[0];
            $to = $translation[1];
            $languages[] = [$from,$to];
        }
        return $languages;
    }
1053121
public function getErrorCodeFromResponseData( array $aResponseData )
    {
        foreach ( $aResponseData as $sKey => $iValue ) {
            if ( preg_match( '/error_(\d+)_code/', $sKey ) ) {
                return (int) $iValue;
            }
        }

        return 999; // UNEXPECTED_ERROR
    }
808342
protected function getBatchResponses(ResponseInterface $response)
    {
        $results = JsonRpc\json_decode((string) $response->getBody(), true);

        return array_map(function (array $result) use ($response) {
            return $this->messageFactory->createResponse(
                $response->getStatusCode(),
                $response->getHeaders(),
                $result
            );
        }, $results);
    }
1076700
protected function parseResponse( Response$response ):array
	{
		$headers= $response->headers;
		$body= $this->achieveSerializer( $this->response_content_type )->decode( $response->body );

		return $this->response_transformer->transform(
			[
				'headers'=> $headers,
				'body'=> $body,
			]
		);
	}
661576
protected function getRemoteResponse($url, array $headers = [])
    {
        $fixedHeaders = ['connection' => 'close'];
        foreach($headers as $key => $header) {
            if (is_int($key)) {
                list($key, $header) = explode(':', $header);
            }
            $key = strtolower($key);
            if (in_array($key, ['cache-control', 'accept', 'user-agent', 'accept-encoding', 'accept-language'])) {
                if (is_array($header)) {
                    $fixedHeaders[$key] = implode('; ', $header);
                }
            }
        }

        $browser = new Browser();
        /** @var \Buzz\Message\Response $res */
        $res = $browser->get($url, $fixedHeaders);
        if ($res->isSuccessful()) {
            $response = new Response($res->getContent(), $res->getStatusCode());
            $headers = [];
            foreach($res->getHeaders() as $header) {
                if (0 < strpos($header, ':')) {
                    list($key, $value) = explode(':', $header);
                    $headers[trim($key)] = trim($value);
                }
            }
            $response->headers->add($headers);
            return $response;
        }

        return null;
    }
668767
private function extractHeadersFromResponse() {
    $response = "";
    $code = $this->response->getStatusCode();
    $text = HttpUtil::getResponseTextForCode($code);
    $response .= sprintf(self::STATUS_LINE_FORMAT, $code, $text);

    foreach($this->response->getHeaderList() as $header) {
      $response .= sprintf("%s: %s%s",
                           $header->getKey(),
                           $header->getValue(),
                           self::CRLF);
    }
    $response .= self::CRLF;
    return $response;
  }
760389
protected function parseResponse(ResponseInterface $response)
    {
        $content = (string) $response->getBody();

        if(strpos($content, "callback") !== false){
            $lpos = strpos($content, "(");
            $rpos = strrpos($content, ")");
            $content  = substr($content, $lpos + 1, $rpos - $lpos -1);

            return $this->parseJson($content);
        } else if(strpos($content, "access_token=") !== false) {
            $result = array();
            parse_str($content, $result);
            return $result;
        } else {
            return parent::parseResponse($response);
        }
    }
413941
public function getQuestionsFor(string $adapter): array
    {
        Assert::that($adapter)->choice(AdapterChoice::AVAILABLE_ADAPTERS);

        switch ($adapter) {
            case DigitalOceanAdapter::NAME:
                return [new AccessTokenQuestion()];
            case CloudFlareAdapter::NAME:
                return [
                    new EmailQuestion(),
                    new ApiKeyQuestion(),
                ];
            default:
                return [];
        }
    }
990139
private function getResponseHeaders()
    {
        if (!$this->responseHeaders) {
            foreach ($this->getSentHeaders() as $item) {
                list($key, $value) = explode(':', $item, 2);

                $this->responseHeaders[$key] = trim($value);
            }
        }

        return $this->responseHeaders;
    }
1228525
protected function getResultFromResponse(Response $response)
    {
        $result = [];

        foreach ($response->getData() as $element) {
            $item = $this->getAttributes($element);
            $item['type'] = $element['type'];
            $result[] = new ElasticIndexer($item);
        }

        return $result;
    }
1066209
public function extractResponseHeadersAndBody()
    {
        $headerSize = $this->getHeaderSize();

        $rawHeaders = mb_substr($this->rawResponse, 0, $headerSize);
        $rawBody = mb_substr($this->rawResponse, $headerSize);

        return [trim($rawHeaders), trim($rawBody)];
    }
1134660
public function getAll(array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->issues()
            ->origins()
            ->types()
            ->getAll($queryParams);

        return new TypesResponse($response);
    }
689473
protected function getResponseContent(ResponseInterface $rawResponse)
    {
        // First check that content in response exists, due too bug: https://bugs.php.net/bug.php?id=54484
        $content = (string) $rawResponse->getBody();
        if (!$content) {
            return [];
        }

        $response = json_decode($content, true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            parse_str($content, $response);
        }

        return $response;
    }
254860
public function parseResponse($response)
    {
        $array = [];

        $exploded = explode('&', $response);

        foreach ($exploded as $explode) {
            $line = explode('=', $explode);

            if (isset($line[1])) {
                $array[$line[0]] = urldecode($line[1]);
            } else {
                $array[] = $explode;
            }
        }

        return $array;
    }