Processing the raw information from a request and inputs it into the IncomingMessage object.

@param $raw
177586
protected function processReceive($raw)
    {
        $incomingMessage = $this->createIncomingMessage();
        $incomingMessage->setRaw($raw);
        $incomingMessage->setMessage($raw->body);
        $incomingMessage->setFrom($raw->from);
        $incomingMessage->setId($raw->sid);
        $incomingMessage->setTo($raw->to);
    }
438549
protected function processReceive($rawMessage)
    {
        $rawMessage = $rawMessage->getSmsStatusResp;
        $incomingMessage = $this->createIncomingMessage();
        $incomingMessage->setRaw($rawMessage);
        $incomingMessage->setFrom($rawMessage->shortcode);
        $incomingMessage->setMessage(null);
        $incomingMessage->setId($rawMessage->id);
        $incomingMessage->setTo(null);

        return $incomingMessage;
    }
1142675
public function process_question(array $data, array $raw) {

        // Convert and write the answers first.
        if (isset($data['answers'])) {
            $this->write_answers($data['answers'], $this->pluginname);
        }

        // Convert and write the numerical units and numerical options.
        if (isset($data['calculated'][0]['numerical_units'])) {
            $numericalunits = $data['calculated'][0]['numerical_units'];
        } else {
            $numericalunits = array();
        }
        $numericaloptions = $this->get_default_numerical_options(
                $data['oldquestiontextformat'], $numericalunits);

        $this->write_numerical_units($numericalunits);
        $this->write_numerical_options($numericaloptions);

        // Write dataset_definitions.
        if (isset($data['calculated'][0]['dataset_definitions']['dataset_definition'])) {
            $datasetdefinitions = $data['calculated'][0]['dataset_definitions']['dataset_definition'];
        } else {
            $datasetdefinitions = array();
        }
        $this->write_dataset_definitions($datasetdefinitions);

        // Write calculated_records.
        $this->xmlwriter->begin_tag('calculated_records');
        foreach ($data['calculated'] as $calculatedrecord) {
            $record = array(
                'id'                  => $this->converter->get_nextid(),
                'answer'              => $calculatedrecord['answer'],
                'tolerance'           => $calculatedrecord['tolerance'],
                'tolerancetype'       => $calculatedrecord['tolerancetype'],
                'correctanswerlength' => $calculatedrecord['correctanswerlength'],
                'correctanswerformat' => $calculatedrecord['correctanswerformat']
            );
            $this->write_xml('calculated_record', $record, array('/calculated_record/id'));
        }
        $this->xmlwriter->end_tag('calculated_records');

        // Write calculated_options.
        $options = array(
            'calculate_option' => array(
                'id'                             => $this->converter->get_nextid(),
                'synchronize'                    => 0,
                'single'                         => 0,
                'shuffleanswers'                 => 0,
                'correctfeedback'                => null,
                'correctfeedbackformat'          => FORMAT_HTML,
                'partiallycorrectfeedback'       => null,
                'partiallycorrectfeedbackformat' => FORMAT_HTML,
                'incorrectfeedback'              => null,
                'incorrectfeedbackformat'        => FORMAT_HTML,
                'answernumbering'                => 'abc'
            )
        );
        $this->write_xml('calculated_options', $options, array('/calculated_options/calculate_option/id'));
    }
1004831
protected function processCurlResponse ($ch, $errCode, $errMsg, $rawResp) {
    // check error codes
    $this->responseCurlErr = $errCode;
    $this->responseCurlErrMessage = $errMsg;

    if (CURLE_OK == $errCode) {
      $info = curl_getinfo($ch);
      $hdrSize = $info['header_size'];
      $respCode = (int) $info['http_code'];

      // parse the raw response
      $rawHeaders = mb_substr($rawResp, 0, $hdrSize, 'latin1');
      $respBody =  mb_substr(
          $rawResp, $hdrSize, mb_strlen($rawResp, 'latin1'), 'latin1');

      // parse response headers
      if ($info['redirect_count'] > 0) {
        // discard redirect headers
        // TODO: there may be useful info in here that we want to preserve
        $headerChunks = explode("\r\n\r\n", $rawHeaders);
        $rawHeaders = $headerChunks[$info['redirect_count']];
      }
      $respHeaderParts = explode("\r\n", $rawHeaders);
      $respHeaders = array();
      foreach ($respHeaderParts as $header) {
        if ($header) {
          $parts = explode(': ', $header, 2);
          $name = $parts[0];
          $value = '';
          if (count($parts) == 2) {
            $value = $parts[1];
          }
          if (isset($respHeaders[$name])) {
            if (!is_array($respHeaders[$name])) {
              // convert single value to collection
              $respHeaders[$name] = array($respHeaders[$name]);
            }
            $respHeaders[$name][] = $value;
          } else {
            $respHeaders[$name] = $value;
          }
        }
      } //end foreach $header

      // fill in request with response
      $this->setResponseCurlInfo($info);
      $this->setResponseHttpCode($respCode);
      $this->setResponseHeaders($respHeaders);
      $this->setResponseBody($respBody);
    } //end if CURLE_OK

    curl_close($ch);
    return $this;
  }
930585
protected function onInput($data)
    {
        //Process data here
        foreach ($this->params as $column) {
            if ($this->character_mask) {
                $data[$column] = trim($data[$column], $this->character_mask);
            } else {
                $data[$column] = trim($data[$column]);
            }
        }
        $this->next($data);
    }
681821
public function process_question(array $data, array $raw) {

        // Convert and write the answers first.
        if (isset($data['answers'])) {
            $this->write_answers($data['answers'], $this->pluginname);
        }

        // Convert and write the multichoice.
        if (!isset($data['multichoice'])) {
            // This should never happen, but it can do if the 1.9 site contained
            // corrupt data.
            $data['multichoice'] = array(array(
                'single'                         => 1,
                'shuffleanswers'                 => 1,
                'correctfeedback'                => '',
                'correctfeedbackformat'          => FORMAT_HTML,
                'partiallycorrectfeedback'       => '',
                'partiallycorrectfeedbackformat' => FORMAT_HTML,
                'incorrectfeedback'              => '',
                'incorrectfeedbackformat'        => FORMAT_HTML,
                'answernumbering'                => 'abc',
            ));
        }
        $this->write_multichoice($data['multichoice'], $data['oldquestiontextformat'], $data['id']);
    }
584956
public function process_question(array $data, array $raw) {

        // Convert match options.
        if (isset($data['randomsamatch'])) {
            $randomsamatch = $data['randomsamatch'][0];
        } else {
            $randomsamatch = array('choose' => 4);
        }
        $randomsamatch['id'] = $this->converter->get_nextid();
        $randomsamatch['subcats'] = 1;
        $randomsamatch['correctfeedback'] = '';
        $randomsamatch['correctfeedbackformat'] = FORMAT_HTML;
        $randomsamatch['partiallycorrectfeedback'] = '';
        $randomsamatch['partiallycorrectfeedbackformat'] = FORMAT_HTML;
        $randomsamatch['incorrectfeedback'] = '';
        $randomsamatch['incorrectfeedbackformat'] = FORMAT_HTML;
        $this->write_xml('randomsamatch', $randomsamatch, array('/randomsamatch/id'));
    }
476736
public function process_question_category($data, $raw) {
        $this->currentcategory    = array_merge($this->currentcategory, $data);
        $this->currentcategoryraw = array_merge($this->currentcategoryraw, $raw);
    }
744022
protected function raw(Raw $raw): string
	{
		$parameters = $raw->getParameters();

		if(!empty($parameters))
		{
			$this->params = array_merge($this->params, $parameters);
		}

		return $raw->getSql();
	}
1251750
function parseRequestData($rawInput = NULL)
    {
        try {

            if ($rawInput == NULL)
                throw new Exception ("Input must be defined", 503);

            $result = array();

            if (is_string($rawInput))
                $result = json_decode($rawInput, TRUE);

            if (is_array($rawInput))
                $result = $rawInput;

            if (is_object($rawInput))
                $result = json_decode(json_encode($rawInput), TRUE);

            return $result;

        } catch (Exception $e) {
            die("Exception raised: " . $e->getMessage() . "\nFile: " . $e->getFile() . "\nLine: " . $e->getLine());
        }
    }
1276897
public function start()
    {
        try {
            /* raw input handler */
            $raw = file_get_contents(php_sapi_name() === 'cli' ? 'php://stdin' : 'php://input');
            if ($this->rawInputHandler !== null) {
                call_user_func($this->rawInputHandler, $raw);
            }
            /* parse the incoming request */
            $request = new Request($raw);
            /* find the CallFlow */
            if (array_key_exists($request->app, $this->cf)) {
                $cf = $this->cf[$request->app];
            } elseif (array_key_exists('*', $this->cf)) {
                $cf = $this->cf['*'];
            } else {
                throw new \Exception("CallFlow for '{$request->app}' Not Found", 404);
            }
            /* call the previous callback. if response is null, we just received a HANGUP */
            if (($label = $cf->callback($request)) !== null) {
                /* call the next label */
                $response = $cf->execute($label);
                /* output response */
                echo $response->getJSON();
            }
        } catch (\Exception $e) {
            /* if an exception is thrown, we reply with an HTTP error */
            echo $this->httpError($e->getMessage(), $e->getCode());
        }
        $output = ob_get_contents();
        /* raw output handler */
        if ($this->rawOutputHandler !== null) {
            call_user_func($this->rawOutputHandler, $output);
        }
        /* Content-Type */
        header('Content-Type: '.self::CONTENT_TYPE);
        /* flush output buffer */
        ob_end_flush();
    }
92012
protected function processReceive($rawMessage)
    {
        $incomingMessage = $this->createIncomingMessage();
        $incomingMessage->setRaw($rawMessage);
        $incomingMessage->setFrom((string) $rawMessage->FromNumber);
        $incomingMessage->setMessage((string) $rawMessage->TextRecord->Message);
        $incomingMessage->setId((string) $rawMessage['id']);
        $incomingMessage->setTo((string) $rawMessage->ToNumber);

        return $incomingMessage;
    }
756901
private function parseRequestHeaders($raw_headers)
    {
        $request_headers = new CaseInsensitiveArray();
        list($first_line, $headers) = $this->parseHeaders($raw_headers);
        $request_headers['Request-Line'] = $first_line;
        foreach ($headers as $key => $value) {
            $request_headers[$key] = $value;
        }
        return $request_headers;
    }
751604
public function fillRawData(string $rawData): TelegramResponse
    {
        $this->rawData = $rawData;
        $this->decodedData = json_decode($this->rawData, true);

        if ($this->decodedData['ok'] === false) {
            $exception = new ClientException();
            $exception->setError(new UnsuccessfulRequest($this->decodedData));
            throw $exception;
        }

        return $this;
    }
225015
protected function parseRaw($raw) {
		$info = preg_split("/\s+/", $raw, 9);
		$stat = array();

		$stat['name'] = join(" ", array_slice($info, 3, 9));
		$stat['read'] = true;
		if ($info[2] == '<DIR>')
		{
			$stat['size'] = 0;
			$stat['mime'] = 'directory';
		}
		else
		{
			$stat['size'] = $info[2];
			$stat['mime'] = $this->mimetype($stat['name']);
		}

		return $stat;
	}
483192
public function send($send_buffer, $raw = false)
    {
        if (false === $raw && $this->protocol) {
            $parser      = $this->protocol;
            $send_buffer = $parser::encode($send_buffer, $this);
            if ($send_buffer === '') {
                return null;
            }
        }
        return strlen($send_buffer) === stream_socket_sendto($this->_socket, $send_buffer, 0, $this->_remoteAddress);
    }
827225
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        if (
            !($attributes = RequestAttributesExtractor::extractAttributes($request))
            || !$attributes['receive']
        ) {
            return;
        }

        if (null === $filters = $request->attributes->get('_api_filters')) {
            $queryString = RequestParser::getQueryString($request);
            $filters = $queryString ? RequestParser::parseRequestParams($queryString) : null;
        }

        $context = null === $filters ? [] : ['filters' => $filters];
        if ($this->serializerContextBuilder) {
            // Builtin data providers are able to use the serialization context to automatically add join clauses
            $context += $normalizationContext = $this->serializerContextBuilder->createFromRequest($request, true, $attributes);
            $request->attributes->set('_api_normalization_context', $normalizationContext);
        }

        if (isset($attributes['collection_operation_name'])) {
            $request->attributes->set('data', $request->isMethod('POST') ? null : $this->getCollectionData($attributes, $context));

            return;
        }

        $data = [];

        if ($this->identifierConverter) {
            $context[IdentifierConverterInterface::HAS_IDENTIFIER_CONVERTER] = true;
        }

        try {
            $identifiers = $this->extractIdentifiers($request->attributes->all(), $attributes);

            if (isset($attributes['item_operation_name'])) {
                $data = $this->getItemData($identifiers, $attributes, $context);
            } elseif (isset($attributes['subresource_operation_name'])) {
                // Legacy
                if (null === $this->subresourceDataProvider) {
                    throw new RuntimeException('No subresource data provider.');
                }

                $data = $this->getSubresourceData($identifiers, $attributes, $context);
            }
        } catch (InvalidIdentifierException $e) {
            throw new NotFoundHttpException('Not found, because of an invalid identifier configuration', $e);
        }

        if (null === $data) {
            throw new NotFoundHttpException('Not Found');
        }

        $request->attributes->set('data', $data);
    }