Parse the data returned by the API.

@param  string $result The raw result string.
@return array
766862
protected function parseResults($result, array $extra_result_data = array())
    {
        // the data sent by the API looks like this
        //  Result=OK
        //  MessageIDs=3c13bbba-a9c2-460c-961b-4d6772960af0

        $data = array();

        // split the lines
        $result_lines = explode("\n", $result);

        // handle the key <-> value pairs
        foreach ($result_lines as $line) {
            if (empty($line)) {
                continue;
            }

            $line_data = explode('=', $line);

            if (count($line_data) === 2) {
              $data[$line_data[0]] = trim(urldecode($line_data[1]));
            }
        }

        // and now, clean a bit the data
        if (isset($data['Result'])) {
            $data['status'] = $data['Result'] == 'OK'
                ? ResultInterface::STATUS_SENT
                : ResultInterface::STATUS_FAILED;
            unset($data['Result']);
        }

        if (isset($data['MessageIDs'])) {
            $data['id'] = $data['MessageIDs'];
            unset($data['MessageIDs']);
        }

        return array_merge($this->getDefaults(), $data, $extra_result_data);
    }
747051
private function transformResult($result)
    {
        if ($this->actualDriver() === self::DRIVER_PREDIS && $result instanceof Status) {
            $result = $result->getPayload() === 'OK';
        }
        return $result;
    }
654860
public function addData(array $result): array
    {
        if ($result['tableName'] === 'sys_redirect' && isset($result['processedTca']['columns']['source_host'])) {
            $domains = $this->getHosts();
            foreach ($domains as $domain) {
                $result['processedTca']['columns']['source_host']['config']['valuePicker']['items'][] =
                    [
                        $domain,
                        $domain,
                    ];
            }
        }
        return $result;
    }
690321
protected static function parseTimesType(&$data, &$result)
    {
        // Time types
        $dataI = self::parseCommon($data, $timeData);
        $result[] = [
            'utctime (' . self::$len . ')',
            $timeData, ];
        $data = $dataI;
    }
577368
protected function processDetails($data, Result &$result)
    {

        // Offload the parsing for these values
        $properties = $this->processProperties($data);

        // Always dedicated
        $result->add('dedicated', 1);

        // Iterate over the properties
        foreach ($properties as $key => $value) {
            $result->add($key, $value);
        }

        // We need to manually figure out the number of players
        $result->add(
            'numplayers',
            ($properties['virtualserver_clientsonline'] - $properties['virtualserver_queryclientsonline'])
        );

        unset($data, $properties, $key, $value);
    }
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;
    }
569193
private function castResult($result)
    {
        try {
            $result = $this->typeAdapter->toArray($result);
        } catch (TypeCastException $exception) {
            return $result;
        }

        return $result;
    }
378936
def parse_result(cls, result):
        
        if isinstance(result, tuple) == 2:
            items, context = result
        else:
            context = {}
            items = result
        return items, context
189994
public function fetchResponse($response, $result)
    {
        if ($response) {
            $data = [];
            while ($row = mssql_fetch_array($response)) {
                $data[] = $row;
            }

            return $data;
        }

        return false;
    }
1166397
protected static function parseIA5String(&$data, &$result)
    {
        // Character string type
        $data = self::parseCommon($data, $stringData);
        $result[] = [
            'IA5 String (' . self::$len . ')',
            $stringData, ];
    }
314999
protected function processDetails($data, Result &$result)
    {

        // Create a buffer
        $buffer = new Buffer($data);

        // Always dedicated
        $result->add('dedicated', 1);

        // Let's loop until we run out of data
        while ($buffer->getLength()) {
            // Grab the row, which is an item
            $row = trim($buffer->readString("\n"));

            // Split out the information
            list($key, $value) = explode('=', $row, 2);

            // Add this to the result
            $result->add($key, utf8_encode($value));
        }

        unset($data, $buffer, $row, $key, $value);
    }
433630
protected function getAll($result = [])
    {

        if (array_key_exists("hits", $result)) {

            $new = [];

            foreach ($result["hits"]["hits"] as $row) {

                $model = $this->model ? new $this->model($row["_source"], true) : new Model($row["_source"], true);

                $model->setConnection($model->getConnection());
                $model->setIndex($row["_index"]);
                $model->setType($row["_type"]);

                // match earlier version

                $model->_index = $row["_index"];
                $model->_type = $row["_type"];
                $model->_id = $row["_id"];
                $model->_score = $row["_score"];

                $new[] = $model;
            }

            $new = new Collection($new);

            $new->total = $result["hits"]["total"];
            $new->max_score = $result["hits"]["max_score"];
            $new->took = $result["took"];
            $new->timed_out = $result["timed_out"];
            $new->scroll_id = isset($result["_scroll_id"]) ? $result["_scroll_id"] : NULL;
            $new->shards = (object)$result["_shards"];

            return $new;

        } else {

            return new Collection([]);

        }
    }
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;
    }
990616
private static function unwrap(array $result): array
    {
        array_walk_recursive($result, function (&$value) {
            if ($value instanceof Image) {
                $value = $value->image;
            }
        });

        return $result;
    }
1243122
private function comList($result)
    {
        foreach ($result as $res) {
            $data[$res->get('id')]['title'] = $res->get('title');
            $data[$res->get('id')]['resume'] = $res->get('resume');
            $data[$res->get('id')]['author'] = $res->get('author');
            $data[$res->get('id')]['autor'] = $res->get('autor');
            $data[$res->get('id')]['category'] = $res->get('category');
            $data[$res->get('id')]['categoria'] = $res->get('categoria');
            $data[$res->get('id')]['link'] = $res->get('link');
            $data[$res->get('id')]['pubdate'] = $res->get('pubdate');
            //$data[$res->get('id')]['image'] = ['type'=>'picture', 'src'=>'/media/blog.png'];

            $media = json_decode($res->get('media'));

            foreach ($media as $img) {
                if (isset($img->type) && $img->type == 'image') {
                    $data[$res->get('id')]['image'] = '/media/article/'.$res->get('id').'/mini_'.basename($img->src);
                    break;
                }

                if (isset($img->type) && $img->type == 'video') {
                    $data[$res->get('id')]['image'] = '/media/v.png';
                }
            }
        }
    
        return $data;
    }
590530
protected function processResult($result)
    {
        $output = Helper::objectToArray($result);

        if (! is_array($output)) {
            throw new Error\Api($output);
        }

        if (isset($output['result'])) {
            return $output;
        }

        if (
            isset($output['request']) &&
            $output['request']['result'] != 1 &&
            $output['request']['result'] !== 'TRUE') {
            throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
        }

        return $output;
    }
698395
protected function parseResults($result, array $extra_result_data = array())
    {
        $data = json_decode($result, true);
        $smsData = array();

        // There was an error
        if (empty($data['transferId']) || empty($data['statusCode'])) {
            return array_merge($this->getDefaults(), $extra_result_data, array(
                    'status' => ResultInterface::STATUS_FAILED,
                )
            );
        }

        // Get the transfer id
        $smsData['id'] = $data['transferId'];

        // Get the status
        switch ($data['statusCode']) {
            case 2000:
                $smsData['status'] = ResultInterface::STATUS_SENT;
                break;
            case 2001:
                $smsData['status'] = ResultInterface::STATUS_QUEUED;
                break;
            default:
                $smsData['status'] = ResultInterface::STATUS_FAILED;
                break;
        }

        return array_merge($this->getDefaults(), $extra_result_data, $smsData);
    }