Parses Request Result and gets Inputs

@param $inputResult

@return array

@throws \Exception
764105
public function getInputsFromResult($inputResult)
    {
        $input_array = [];

        if (!isset($inputResult['inputs'])) {
            throw new \Exception('Inputs Not Found');
        }

        foreach ($inputResult['inputs'] as $rawInput) {
            $input = new Input($rawInput);
            $input_array[] = $input;
        }

        return $input_array;
    }
418790
public function parse(Input $input)
    {
        // fill config
        $this->config = $this->default;

        if ($input instanceof RequestInput) {
            $this->config['optional_item_id'] = true;
        }

        $object = $input->getAsObject();

        $document = $this->getFactory()->make(
            'Document',
            [$object, $this, new RootAccessable]
        );

        // Clear config
        $this->config = [];

        return $document;
    }
490213
public function parse($input)
    {
        $queries = new AndQuery();

        foreach (explode(',', $input) as $query) {
            list($property, $value) = explode('=', $query);

            $queries->add(new Equal($property, $value));
        }

        return $queries;
    }
485209
protected function parseRequest()
    {
        if ($this->customParams === false) {
            // pull various supported inputs from post
            $request = $this->di->get('request');

            // only process if it is a get
            if ($request->isGet() == false) {
                return;
            }
        } else {
            $_REQUEST = $_GET = $this->customParams;
            $request = $this->di->get('request');
        }

        // simple stuff first
        $with = $request->get('with', "string", null);
        $include = $request->get('include', "string", null);
        if (!is_null($with)) {
            $this->suppliedWith = $with;
        } elseif (!is_null($include)) {
            $this->suppliedWith = $include;
        }

        // load possible sort values in the following order
        // be sure to mark this as a paginated result set
        if ($request->get('sort', "string", null) != null) {
            $this->suppliedSort = $request->get('sort', "string", null);
            $this->isPager = true;
        } elseif ($request->get('sort_field', "string", null) != null) {
            $this->suppliedSort = $request->get('sort_field', "string", null);
            $this->isPager = true;
        } elseif ($request->get('sortField', "string", null) != null) {
            $this->suppliedSort = $request->get('sortField', "string", null);
            $this->isPager = true;
        }

        // prep for the harder stuff
        // ?page=1&perPage=25&orderAscending=false

        // load possible limit values in the following order
        // be sure to mark this as a paginated result set
        if ($request->get('limit', "string", null) != null) {
            $this->suppliedLimit = $request->get('limit', "string", null);
            $this->isPager = true;
        } elseif ($request->get('per_page', "string", null) != null) {
            $this->suppliedLimit = $request->get('per_page', "string", null);
            $this->isPager = true;
        } elseif ($request->get('perPage', "string", null) != null) {
            $this->suppliedLimit = $request->get('perPage', "string", null);
            $this->isPager = true;
        }

        // look for string that means to show all records
        if ($this->isPager) {
            if ($this->suppliedLimit == 'all') {
                $this->suppliedLimit = 9999999999;
            }
        }

        // load offset values in the following order
        // Notice that a page is treated differently than offset
        // $this->offset = ($offset != null) ? $offset : $this->offset;
        if ($request->get('offset', "int", null) != null) {
            $this->suppliedOffset = $request->get('offset', "int", null);
            $this->isPager = true;
        } elseif ($request->get('page', "int", null) != null) {
            $this->suppliedOffset = ($request->get('page', "int", null) - 1) * $this->suppliedLimit;
            $this->isPager = true;
        }

        // Check if we pass the count parameter with whatever value
        if ($request->has('count')) {
            $this->isCount = true;
        }

        // http://jsonapi.org/format/#fetching
        $this->parseSearchParameters($request);
    }
371248
public function parse(string $input)
    {
        $ts = $this->lexer->tokenize($input);
        $parseResult = $this->parseImplementation($ts);

        if ($ts->hasPendingTokens()) {
            throw new SyntaxErrorException('There are tokens not processed.');
        }

        return $parseResult;
    }
569193
private function castResult($result)
    {
        try {
            $result = $this->typeAdapter->toArray($result);
        } catch (TypeCastException $exception) {
            return $result;
        }

        return $result;
    }
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);
    }
936138
public function getModelsFromResult($modelResult)
    {
        $modelsArray = [];

        if (isset($modelResult['models'])) {
            foreach ($modelResult['models'] as $model) {
                $model = new Model($model);
                $modelsArray[] = $model;
            }
        } else {
            throw new \Exception('Models Not Found');
        }

        return $modelsArray;
    }
1060628
public function filterBySysLanguage($queryResult, $exceptions = []) {
    $result = $queryResult;

    if (is_string($exceptions)) {
      $exceptions = GeneralUtility::intExplode(',', $exceptions, true);
    }

    $sysLanguageUid = $this->languageService->getSysLanguageUid();

    if (!in_array($sysLanguageUid, $exceptions, true)) {
      $result = [];

      foreach ($queryResult as $object) {
        $uid = $object->getSysLanguageUid();

        if (isset($uid) && $uid == $sysLanguageUid) {
          $result[] = $object;
        }
      }
    }

    return $result;
  }
908002
public static function getParameters($input): array
    {
        try {
            $reflectionMethod = self::getCallableReflectionMethod($input);
        } catch (ReflectionException $e) {
            return [];
        }

        foreach ($reflectionMethod->getParameters() as $index => $param) {
            $reflectionParameters[$index]['name'] = $param->getName();
            if (null !== $param->getClass()) {
                $reflectionParameters[$index]['class'] = $param->getClass()->name;
            }
        }

        return $reflectionParameters ?? [];
    }
555924
public static function parseParameters($input)
    {
        if (!isset($input) || !$input) {
            return array();
        }

        $pairs = explode('&', $input);

        $parsedParameters = array();
        foreach ($pairs as $pair) {
            $split = explode('=', $pair, 2);
            $parameter = self::urldecodeRfc3986($split[0]);
            $value = isset($split[1]) ? self::urldecodeRfc3986($split[1]) : '';

            if (isset($parsedParameters[$parameter])) {
                // We have already recieved parameter(s) with this name, so add to the list
                // of parameters with this name

                if (is_scalar($parsedParameters[$parameter])) {
                    // This is the first duplicate, so transform scalar (string) into an array
                    // so we can add the duplicates
                    $parsedParameters[$parameter] = array($parsedParameters[$parameter]);
                }

                $parsedParameters[$parameter][] = $value;
            } else {
                $parsedParameters[$parameter] = $value;
            }
        }
        return $parsedParameters;
    }
154492
private function input(ServerRequestInterface $request): array
    {
        if (! is_null($this->parser)) {

            $input = ($this->parser)($request);

            if (is_array($input)) {

                return $input;

            }

            throw new InputTypeException($input);

        }

        return array_merge(
            $request->getAttributes(),
            $request->getQueryParams(),
            $request->getParsedBody(),
            $request->getUploadedFiles()
        );
    }
1113199
protected function ParseXMLResponse($sResult)
    {
        $oXMLResponse = new SimpleXMLElement($sResult);
        foreach ($oXMLResponse->attributes() as $sAttributeName => $sAttributeValue) {
            $sAttributeName = strtoupper($sAttributeName);
            $this->aXMLResponseData[$sAttributeName] = (string) $sAttributeValue;
        }
        if (isset($oXMLResponse->HTML_ANSWER)) {
            $this->aXMLResponseData['HTML_ANSWER'] = (string) $oXMLResponse->HTML_ANSWER;
        }
    }
618662
public function getFieldsValuesDataAttributes(FormResult $formResult)
    {
        $result = [];
        $formObject = $this->getFormObject();
        $formInstance = $formObject->getForm();

        foreach ($formObject->getConfiguration()->getFields() as $field) {
            $fieldName = $field->getName();

            if (false === $formResult->fieldIsDeactivated($field)) {
                $value = ObjectAccess::getProperty($formInstance, $fieldName);
                $value = (is_array($value))
                    ? implode(' ', $value)
                    : $value;

                if (false === empty($value)) {
                    $result[self::getFieldDataValueKey($fieldName)] = $value;
                }
            }
        }

        return $result;
    }
2438
protected function doInput()
    {
        /* @var $result IReadResult */
        $this->resetInput();
        $this->inputAttemptsUsed++;
        $result = $this->playPrePromptMessages();
        if (!$this->acceptPrePromptInputAsInput) {
            $result = $this->playPromptMessages();
            if ($result !== null && !$result->isTimeout()) {
                $this->acceptInput($result->getDigits());
            }
        } elseif ($result !== null && !$result->isTimeout()) {
            $this->acceptInput($result->getDigits());
        } else {
            $result = $this->playPromptMessages();
            if ($result !== null) {
                $this->acceptInput($result->getDigits());
            }
        }
        if ($this->inputLengthIsAtLeast($this->maxInput) // max = 1
            || $this->wasCancelled()
            || ($this->isComplete() && !$this->hasInput()) // user pressed eoi
        ) {
            return;
        }
        $len = strlen($this->input);
        $start = time();
        for ($i = $len; $i < $this->maxInput; $i++) {
            if ($this->totalTimeForInput != -1) {
                $totalElapsedTime = (time() - $start) * 1000;
                if ($totalElapsedTime >= $this->totalTimeForInput) {
                    $this->logDebug("Expired total available time for input");
                    break;
                }
            }
            $this->logDebug($this->name . ": Reading Digit #: " . ($i + 1));
            $result = $this->callClientMethods(array(
                    array('waitDigit' => array($this->timeBetweenDigits))
            ));
            if ($result->isTimeout()) {
                $this->logDebug("Expired available time per digit");
                break;
            }
            $input = $result->getDigits();
            $this->acceptInput($input);
            if ($this->inputIsEnd($input) || $this->wasCancelled()) {
                break;
            }
        }
    }
710897
public function getTypeOfResult(): string
    {
        switch (gettype($this->decodedData['result'])) {
            case 'array':
            case 'integer':
            case 'boolean':
                return gettype($this->decodedData['result']);
            default:
                throw new InvalidResultType(
                    sprintf('The passed data type ("%s") is not supported', gettype($this->decodedData['result']))
                );
        }
    }
772611
public function parseResults(LoopResult $loopResult)
    {
        /** @var DealerContactInfo $contact */
        foreach ($loopResult->getResultDataCollection() as $contact) {
            $loopResultRow = new LoopResultRow($contact);

            $loopResultRow
                ->set('ID', $contact->getId())
                ->set('CONTACT_ID', $contact->getContactId())
                ->set('CONTACT_TYPE', $contact->getContactType())
                ->set('CONTACT_TYPE_ID', $contact->getContactTypeId());

            if ($contact->hasVirtualColumn('i18n_VALUE')) {
                $loopResultRow->set("VALUE", $contact->getVirtualColumn('i18n_VALUE'));
            }

            $loopResult->addRow($loopResultRow);
        }

        return $loopResult;
    }