Parse API response and return array of branch data.

@param \stdClass $response API response.

@return array Array of branch data.
488701
public function parse_branch_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}
		$branches = [];
		foreach ( $response as $branch ) {
			$branches[ $branch->name ]['download']         = $this->construct_download_link( $branch->name );
			$branches[ $branch->name ]['commit_hash']      = $branch->target->hash;
			$branches[ $branch->name ]['commit_timestamp'] = $branch->target->date;
		}
		return $branches;
	}
715178
public function parse_meta_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}
		$arr      = [];
		$response = [ $response ];

		array_filter(
			$response,
			function ( $e ) use ( &$arr ) {
				$arr['private']      = $e->private;
				$arr['last_updated'] = $e->pushed_at;
				$arr['watchers']     = $e->watchers;
				$arr['forks']        = $e->forks;
				$arr['open_issues']  = $e->open_issues;
			}
		);

		return $arr;
	}
880174
private static function getHeaderAndBody($response) {
    $header = self::http_parse_headers(substr($response, 0, strrpos($response,"\r\n\r\n")));
    $body = substr($response, strrpos($response,"\r\n\r\n")+4);

    return array($header,$body);
  }
702820
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            return $jsonData['result']['account'];
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
1222121
protected function parseCurlResponse($response)
    {
        $pattern = '|HTTP/\d\.\d.*?$.*?\r\n\r\n|ims';
        preg_match_all($pattern, $response, $matches);
        $header = array_pop($matches[0]);
        # Remove headers from the response body
        $body = str_replace($header, '', $response);

        return array(
            'header' => $header,
            'body' => $body,
        );
    }
1256160
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode'] && !empty($jsonData['result'])) {
            $messages = [];
            foreach ($jsonData['result'] as $messageData) {
                $messages[] = static::makeResponseMessage($messageData['poll_type'], $messageData);
            }

            return $messages;
        } elseif (103 == $jsonData['retcode']) {
            throw new Code103ResponseException($response);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
595430
private function parseBranch(\stdClass $data, $branchClass)
    {
        /** @var \Brain\Hierarchy\Branch\BranchInterface $branch */
        $branch = new $branchClass();
        $name = $branch->name();
        $isFilterable = ($this->flags & self::FILTERABLE) > 0;
        // When branches are filterable, we need this for core compatibility.
        $isFilterable and $name = preg_replace('|[^a-z0-9-]+|', '', $name);
        if ($branch->is($data->query) && ! isset($data->hierarchy[$name])) {
            $leaves = $branch->leaves($data->query);
            // this filter was introduced in WP 4.7
            $isFilterable and $leaves = apply_filters("{$name}_template_hierarchy", $leaves);
            $data->hierarchy[$name] = $leaves;
            $data->templates = array_merge($data->templates, $leaves);
        }

        return $data;
    }
650802
protected function _result($response)
    {
        $this->_info();

        $this->curl->close();

        $this->_default();

        if( Json::check($response) )
        {
            return json_decode($response);
        }
        elseif( XML\Check::check($response) )
        {
            return XML\Parser::simple($response);
        }
        else
        {
            return $response;
        }
    }
1181502
public static function response($response)
    {
        $result = [];
        if (is_numeric($response)) {
            header('HTTP/1.1 '.$response);
            $result['status'] = $response;
            $result['status_message'] = self::toResponse($response);
            $result['data'] = [];
        } else {
            header('HTTP/1.1 '. 200);
            $result['status'] = 200;
            $result['status_message'] = 'Success';
            $result['data'] = self::superEncode($response);
        }

        $json_response = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        $json_response = str_replace('\\\\', '', $json_response);

        return $json_response;
    }
1081767
protected static function parseJSONResponse($response)
    {
        $result = json_decode($response->body, true);
        if ($result == null) {
            $error = json_last_error();
            throw new Error(
                "Error parsing server response ({$response->responseCode}) - {$response->body}. Got - {$error}"
            );
        }

        return $result;
    }
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;
    }
260953
public function populate(stdClass $response)
    {
        $transaction = $this->transaction($response);

        $transaction->creditCard = $this->creditCard($response);

        if (isset($response->id_assinatura)) {
            $transaction->subscription = $this->subscription($response);
        }

        return $transaction;
    }
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;
    }
96668
protected function parse_result( $response ) {
		if ( is_wp_error( $response ) ) {
			return (object) [
				'success' => false,
				'version' => false,
				'error'   => $response->get_error_code(),
				'message' => $response->get_error_message(),
			];
		} else {
			$result = json_decode( $response );
			if ( is_null( $result ) ) {
				return (object) [
					'success' => false,
					'version' => false,
					'error'   => '500',
					'message' => 'Parser Error',
				];
			} else {
				return $result;
			}
		}
	}
996608
function jsonSerialize(): \stdClass {
    return (object) [
      'lineNumber' => $this->getLineNumber(),
      'blockNumber' => $this->getBlockNumber(),
      'branchNumber' => $this->getBranchNumber(),
      'taken' => $this->getTaken()
    ];
  }
1131970
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $recentList = [];
            foreach ($jsonData['result'] as $recent) {
                $recentList[] = EntityFactory::createEntity(Recent::class, [
                    'type' => $recent['type'],
                    'uin' => $recent['uin'],
                ]);
            }

            return new EntityCollection($recentList);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
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;
    }