Parses the data returned by the API for a "status" request.

@param string $result            The raw result string.
@param array  $extra_result_data

@return array
351614
protected function parseStatusResults($result, array $extra_result_data = array())
    {
        $result = trim($result);

        $this->checkForUnrecoverableError($result);

        return $this->checkForStatusResult($result);
    }
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);
    }
637729
private function resultToResponse($result) : Response
	{
		switch (true) {
			// Response object
			case $result instanceof Response:
				return $result;
			// String -> transform to response
			case is_string($result) || is_numeric($result):
				return new Response($result);
			// Array -> transform to json response
			case is_array($result) || is_object($result):
				return new JsonResponse($result);
			default:
				throw new Exception('Invalid route handler return value');
		}
	}
253061
protected function processI(array $result) {
		$entity = df_ic($this->entityC(), O::class, $result); /** @var O $entity */
		$entity->validate();
		return $result;
	}
755016
protected function success($results = null)
    {
        $this->trigger('json-success', $this, $results);
        $this->trigger('response-success', $this, $results);

        $json = array('error' => false);

        if($results) {
            $json['results'] = $results;
        }

        $body = json_encode($json, JSON_PRETTY_PRINT);

        $this->response
            ->set('headers', 'Content-Type', 'text/json')
            ->set('body', $body);

        return $body;
    }
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;
    }
981420
protected function parseSendResponse($result, array $extra_result_data = array())
    {
        libxml_use_internal_errors(true);
        if (false === ($result = simplexml_load_string(trim($result)))) {
            throw new Exception\RuntimeException('API response isn\'t a valid XML string');
        }

        if (null !== ($error = $this->checkForError($result))) {
            throw $error;
        }

        // The message was successfully sent!
        return array_merge($this->getDefaults(), $extra_result_data, array(
            'status'    => ResultInterface::STATUS_SENT,
            'id'        => (string) $result->GUID['GUID']
        ));
    }
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;
    }
721191
private static function convertResult($result)
    {
        if (!is_array($result)) {
            return self::convert($result);
        }

        $results = [];

        foreach ($result as $item) {
            $results[] = self::convert($item);
        }

        return $results;
    }
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;
    }
739659
protected function getResponse( $result )
    {
        $this->response
             ->setContent( xmlrpc_encode_request(
                    null, $result,
                    array( 'encoding' => 'utf-8' )
                ) );

        return $this->response;
    }
180714
public static function success($code = '', $message = '', $errors = [], $extras = [])
    {
        return self::loadResult(self::SUCCESS, $code, $message, $errors, $extras);
    }
406970
public function execute(AbstractResult $result)
    {
            $query = http_build_query(
                $this->getParams()
            );

            $url      = $this->apiUrl . $this->getMethod() . '?' . $query;
            $response = $this->downloader->download($url);

            $responseJson = json_decode($response);
            if ( ! $responseJson) {
                throw new RuntimeException('Failed to parse Response. Invalid Json: ' . $response);
            }

            if (isset($responseJson->errno)) {
                throw new ApiException($responseJson->errmsg, $responseJson->errno);
            }
            $result->parseResponse($responseJson);
            $result->setQueryUrl($url);

            return $result;
    }
887864
public function post($url, $data = array(), array $extra = array())
    {
        $curl = new Curl(array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HEADER => false,
            CURLOPT_POST => count($data),
            CURLOPT_POSTFIELDS => http_build_query($data)

        ), $extra);

        return $curl->exec();
    }
244928
protected static function parseHexExtensions(&$data, &$result, $text)
    {
        $extensionData = substr($data, 0, 1);
        $dataI = substr($data, 1);
        $result[] = [
            $text . ' (' . self::$len . ')',
            dechex($extensionData), ];
        $data = $dataI;
    }
724688
protected static function parsePrintableString(&$data, &$result)
    {
        // Printable string type
        $data = self::parseCommon($data, $stringData);
        $result[] = [
            'Printable String (' . self::$len . ')',
            $stringData, ];
    }
1358373
private function format($result, $count, $offset, $limit)
    {
        $nodes = [];
        foreach ($result as $item) {
            $resource = $this->getResource($item);
            $data = $this->getResourceData($resource);
            if ($data) {
                $nodes[] = $data;
            }
        }
        return [
            'total'  => $count,
            'offset' => $offset,
            'limit'  => $limit,
            'nodes'  => $nodes
        ];
    }