@param ResultSpec $result

@return string
426630
public function build(ResultSpec $result): string
    {
        $response = [];
        $units = $result->getResults();

        foreach ($units as $unit) {
            /** @var AbstractResult $unit */
            if ($unit instanceof Result) {
                /** @var Result $unit */
                $response[] = [
                    'jsonrpc' => '2.0',
                    'result' => $this->preBuild($unit->getResult()),
                    'id'     => $unit->getId()
                ];
            } elseif ($unit instanceof Error) {
                /** @var Error $unit */
                $baseException = $unit->getBaseException();
                $response[] = [
                    'jsonrpc' => '2.0',
                    'error' => [
                        'code'    => $baseException->getJsonRpcCode(),
                        'message' => $this->getErrorMessage($baseException->getJsonRpcCode()),
                        'data'    => $baseException->getJsonRpcData()
                    ],
                    'id' => $unit->getId()
                ];
            }
        }

        if (empty($response)) {
            return '';
        }

        if ($result->isSingleResult()) {
            return json_encode($response[0]);
        }

        return json_encode($response);
    }
1166397
protected static function parseIA5String(&$data, &$result)
    {
        // Character string type
        $data = self::parseCommon($data, $stringData);
        $result[] = [
            'IA5 String (' . self::$len . ')',
            $stringData, ];
    }
1194021
public function parserResult($result)
    {
        if ($this->presenter instanceof PresenterInterface) {
            if ($result instanceof Collection || $result instanceof LengthAwarePaginator) {
                $result->each(function ($model) {
                    if ($model instanceof Presentable) {
                        $model->setPresenter($this->presenter);
                    }

                    return $model;
                });
            } elseif ($result instanceof Presentable) {
                $result = $result->setPresenter($this->presenter);
            }

            if (!$this->skipPresenter) {
                return $this->presenter->present($result);
            }
        }

        return $result;
    }
179781
private function getErrorMessage(array $result)
    {
        $errorMessage = '';
        if (isset($result['errors'][0]['property']) && isset($result['errors'][0]['message'])) {
            $errorMessage = $result['errors'][0]['property'] . ': ' . $result['errors'][0]['message'];
        }
        return $errorMessage;
    }
1335237
public function generateNav ($result)
        {
            /**
             * @global object $navComponentObject
             */

            if ($this->arParams['DISPLAY_BOTTOM_PAGER'] === 'Y' || $this->arParams['DISPLAY_TOP_PAGER'] === 'Y')
            {
                $this->arResult['NAV_STRING'] = $result->GetPageNavStringEx (
                    $navComponentObject,
                    $this->arParams['PAGER_TITLE'],
                    $this->arParams['PAGER_TEMPLATE'],
                    $this->arParams['PAGER_SHOW_ALWAYS']
                );
                $this->arResult['NAV_CACHED_DATA'] = $navComponentObject->GetTemplateCachedData ();
                $this->arResult['NAV_RESULT'] = $result;
            }
        }
131874
private function createResult($result)
    {
        switch (\pg_result_status($result, \PGSQL_STATUS_LONG)) {
            case \PGSQL_EMPTY_QUERY:
                throw new QueryError("Empty query string");

            case \PGSQL_COMMAND_OK:
                return new PgSqlCommandResult($result);

            case \PGSQL_TUPLES_OK:
                return new PgSqlResultSet($result);

            case \PGSQL_NONFATAL_ERROR:
            case \PGSQL_FATAL_ERROR:
                $diagnostics = [];
                foreach (self::DIAGNOSTIC_CODES as $fieldCode => $desciption) {
                    $diagnostics[$desciption] = \pg_result_error_field($result, $fieldCode);
                }
                throw new QueryExecutionError(\pg_result_error($result), $diagnostics);

            case \PGSQL_BAD_RESPONSE:
                throw new FailureException(\pg_result_error($result));

            default:
                // @codeCoverageIgnoreStart
                throw new FailureException("Unknown result status");
                // @codeCoverageIgnoreEnd
        }
    }
103689
public function removePriceRangeFilter(Result $result): string
    {
        $urlParameters = $this->generateQueryUrlParameters($result);
        unset($urlParameters['price']);

        return $this->createUrlByUrlParameters(
            $result,
            $urlParameters
        )['route'];
    }
1112576
public function addPrevPage(Result $result): ? string
    {
        $query = $result->getQuery();
        $urlParameters = $this->generateQueryUrlParameters($result);
        $page = $query->getPage();
        $prevPage = $page - 1;

        if ($prevPage < 1) {
            return null;
        }

        $urlParameters['page'] = $prevPage;

        return $this->createUrlByUrlParameters(
            $result,
            $urlParameters
        )['route'];
    }
1176251
protected function getErrorText(Result $result)
    {
        /** @var $view StandaloneView */
        $view = Core::instantiate(StandaloneView::class);
        $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:' . ExtensionService::get()->getExtensionKey() . '/Resources/Private/Templates/Error/ConfigurationErrorBlock.html'));
        $layoutRootPath = StringService::get()->getExtensionRelativePath('Resources/Private/Layouts');
        $view->setLayoutRootPaths([$layoutRootPath]);
        $view->assign('result', $result);

        $templatePath = GeneralUtility::getFileAbsFileName('EXT:' . ExtensionService::get()->getExtensionKey() . '/Resources/Public/StyleSheets/Form.ErrorBlock.css');
        $this->pageRenderer->addCssFile(StringService::get()->getResourceRelativePath($templatePath));

        return $view->render();
    }
604459
private function parseQueryResult($result = [])
    {
        $rdsDeliveryExecution = new RdsDeliveryExecution($this);

        if (array_key_exists(self::COLUMN_ID, $result)) {
            $rdsDeliveryExecution->setIdentifier($result[self::COLUMN_ID]);
        }

        if (array_key_exists(self::COLUMN_LABEL, $result)) {
            $rdsDeliveryExecution->setLabel($result[self::COLUMN_LABEL]);
        }

        if (array_key_exists(self::COLUMN_DELIVERY_ID, $result)) {
            $rdsDeliveryExecution->setDelivery($result[self::COLUMN_DELIVERY_ID]);
        }

        if (array_key_exists(self::COLUMN_STATUS, $result)) {
            $rdsDeliveryExecution->setState($result[self::COLUMN_STATUS]);
        }

        if (array_key_exists(self::COLUMN_USER_ID, $result)) {
            $rdsDeliveryExecution->setUserIdentifier($result[self::COLUMN_USER_ID]);
        }

        if (array_key_exists(self::COLUMN_STARTED_AT, $result)) {
            $rdsDeliveryExecution->setStartTime(new \DateTime($result[self::COLUMN_STARTED_AT]));
        }

        if (array_key_exists(self::COLUMN_FINISHED_AT, $result)) {
            $rdsDeliveryExecution->setFinishTime(new \DateTime($result[self::COLUMN_FINISHED_AT]));
        }

        return $this->propagate(new DeliveryExecution($rdsDeliveryExecution));
    }
566746
private function getProcessedTemplateBeforeSave($result)
    {
        //saving array values
        if (empty($args)) {
            $this->getResultIfArgsEmptyForBeforeSave($result);
        } else {
            //saving string value
            $field = $args[0];

            //compress the text body when is a dotmailer template
            if ($field == 'template_text' && ! $this->isStringCompressed($result) &&
                $this->transactionalHelper->isDotmailerTemplate($this->templateCode)
            ) {
                $result = $this->compressString($result);
            }
            if ($field == 'template_id') {
                $this->saveTemplateIdInRegistry($result);
            }
        }

        return $result;
    }
739659
protected function getResponse( $result )
    {
        $this->response
             ->setContent( xmlrpc_encode_request(
                    null, $result,
                    array( 'encoding' => 'utf-8' )
                ) );

        return $this->response;
    }
1262140
protected static function parseCommon($data, &$result)
    {
        self::$len = (int) ord($data[1]);
        $bytes = 0;
        self::getLength(self::$len, $bytes, (string) $data);
        $result = substr($data, 2 + $bytes, self::$len);

        return substr($data, 2 + $bytes + self::$len);
    }
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);
    }
518390
public function processColumnListing($results)
	{
		$mapping = function ($r) {
			$r = (object) $r;

			return $r->name;
		};

		return array_map($mapping, $results);
	}
988830
protected static function parseCharString(&$data, &$result)
    {
        // Character string type
        $data = self::parseCommon($data, $stringData);
        $result[] = [
            'string (' . self::$len . ')',
            self::printHex((string) $stringData), ];
    }
650932
protected function formatSuccess($result)
    {
        switch ($this->outputMode) {
            case self::MODE_SINGLE:
                $result->data = array_values($this->data)[0];
                break;

            case self::MODE_MULTIPLE:
                $result->data = array_values($this->data);
                break;

            case self::MODE_OTHER:
                // do nothing for this output mode
                break;

            default:
                throw new HTTPException('Error generating output.  Cannot match output mode with data set.', 500, [
                    'code' => '894684684646846816161'
                ]);
        }

        // process included records if there's valid entries only
        if ($this->data && $this->included) {
            $result->included = array_flatten($this->included);
        }
    }