Return expected response type based on URL.

@param void

@return string
513720
private function getResponseType()
    {
        if (false === strpos($this->url, '.')) {
            return "";
        }
        list($path, $type) = explode('.', basename($this->url), 2);

        return $type;
    }
331006
public function getContentType(): string
	{
		if($this->contentType === null)
		{
			$this->contentType = rtrim(strtok((string) $this->headers->get('content-type'), ';'));
		}

		return $this->contentType;
	}
275284
static public function detectClientType()
    {
        $clientType       = static::PC;
        if (HttpHelper::isMobile()) {
            if (HttpHelper::isWechat()) {
                $clientType = static::WX;
            } elseif (HttpHelper::isAlipay()) {
                $clientType = static::ALIPAY;
            } else {
                $clientType = static::MOBILE;
            }
        }
        
        return $clientType;
    }
63763
public function type()
    {
        $accept = $this->server('HTTP_ACCEPT');
        if (empty($accept)) {
            return false;
        }

        foreach ($this->mimeType as $key => $val) {
            $array = explode(',', $val);
            foreach ($array as $k => $v) {
                if (stristr($accept, $v)) {
                    return $key;
                }
            }
        }
        return false;
    }
1013038
public function contentType() {
        $headers = array('CONTENT_TYPE', 'HTTP_CONTENT_TYPE');

        foreach ($headers as $header) {
            if (!empty($this->serverVariables[$header])) {
                return $this->serverVariables[$header];
            }
        }

        return '';
    }
1249061
private function getResponse()
    {
        $success = $this->handler->recv();
        $this->result = new Response((string)$this->handler->body, $this->handler->statusCode);
        if($success)
        {
            // headers
            foreach($this->handler->headers as $name => $value)
            {
                $this->result = $this->result->withHeader($name, $value);
            }

            // cookies
            $cookies = [];
            if(isset($this->handler->set_cookie_headers))
            {
                foreach($this->handler->set_cookie_headers as $value)
                {
                    $list = explode(';', $value);
                    $count2 = count($list);
                    if(isset($list[0]))
                    {
                        list($cookieName, $value) = explode('=', $list[0], 2);
                        $cookieName = trim($cookieName);
                        $cookies[$cookieName] = array('value'=>$value);
                        for($j = 1; $j < $count2; ++$j)
                        {
                            $kv = explode('=', $list[$j], 2);
                            $cookies[$cookieName][trim($kv[0])] = isset($kv[1]) ? $kv[1] : true;
                        }
                    }
                }
            }
            foreach($this->handler->cookies as $name => $value)
            {
                if(!isset($cookies[$name]))
                {
                    $cookies[$name] = ['value'=>$value];
                }
            }
            $this->result = $this->result->withCookieOriginParams($cookies);
        }
        $this->result = $this->result->withError($this->getErrorString($this->handler->errCode))
                                     ->withErrno($this->handler->errCode);
        $this->handler->close();
        return $this->result;
    }
856334
public function getContentType()
    {
        if (isset($this->responseInfo['content_type'])) {
            $contentType = $this->responseInfo['content_type'];
        } else {
            $contentType = isset($this->responseHeaders['Content-Type']) ? $this->responseHeaders['Content-Type'] : null;
        }
        
        if ($contentType) {
            $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType);
            return strtolower($contentTypeParts[0]);
        }
        
        return null;
    }
29777
public function getQueryResponse()
    {
        $this->meta['response'] = $this->getResponse();
        parse_str($this->meta['response'], $response);
        return $response;
    }
1072670
protected function parseAutodiscoverResponse()
    {
        // Content-type isn't trustworthy, unfortunately. Shame on Microsoft.
        if (substr($this->last_response, 0, 5) !== '<?xml') {
            return false;
        }

        $response = $this->responseToArray($this->last_response);

        if (isset($response['Error'])) {
            $this->error = $response['Error'];
            return false;
        }

        // Check the account action for redirect.
        switch ($response['Account']['Action']) {
            case 'redirectUrl':
                $this->redirect = array(
                    'redirectUrl' => $response['Account']['RedirectUrl']
                );
                return false;
            case 'redirectAddr':
                $this->redirect = array(
                    'redirectAddr' => $response['Account']['RedirectAddr']
                );
                return false;
            case 'settings':
            default:
                $this->discovered = $response;
                return true;
        }
    }
1249421
public function api_respond() {
		// Is a data response type not defined or not available?
		if ( !isset($this->response->type) || !array_key_exists($this->response->type, $this->config['rest']['mime_types']) ) {
			// Use a short-style ternary (PHP 5.3) to either grab the default or use this hard-coded default
			$this->response->type = $this->config['rest']['defaults']['data_type'] ?: 'json';
		}

		// Set our data response header
		$this->response->header( 'Content-Type', $this->config['rest']['mime_types'][$this->response->type] );

		// Set our allowed methods response header
		if ( !is_null( $this->response->possible_methods ) ) {
			$this->response->header( 'Allow', implode( ', ', $this->response->possible_methods ) );
		}

		// Send our access control headers
		$this->response->header( 'Access-Control-Allow-Headers', $this->config['rest']['http_access_control']['allow_headers']);
		$this->response->header( 'Access-Control-Allow-Methods', $this->config['rest']['http_access_control']['allow_methods']);
		$this->response->header( 'Access-Control-Allow-Origin', $this->config['rest']['http_access_control']['allow_origin']);

		// Let's build our response data
		$response_data = new stdClass();
		$response_data->meta = (object) array(
			'status_code' => (int) $this->response->code(),
			'status' => (string) $this->get_status(),
			'message' => (string) $this->response->message ?: (string) null,
			'more_info' => $this->response->more_info ?: (object) null,
		);
		$response_data->data = $this->response->data ?: (object) null;

		// Only add paging data if it exists
		if ( isset($this->response->paging) ) {
			$response_data->paging = $this->response->paging;
		}

		// If global template processing is turned on
		if ( $this->config['template']['global_template_processing'] ) {
			// If we only want to process our returned "data"
			if ( $this->config['template']['only_process_returned_data'] ) {
				// Set our data to be processed as the "data" property of our response data
				$raw_data = &$response_data->data;
			}
			else {
				// Otherwise, set our raw data as our entire response data object
				$raw_data = &$response_data;
			}

			// Process our data for templating
			$raw_data = $this->process_template( $raw_data );
		}

		// Let's encode our response based on our set type
		if ( $this->response->type == 'json' ) {
			$this->response->json( $response_data );
		}
		elseif ( $this->response->type == 'jsonp' ) {
			$this->response->json( $response_data, $this->config['rest']['defaults']['jsonp_padding'] ?: 'callback' );
		}
		// If all else fails, just var_dump
		else {
			var_dump( $response_data );
		}

		// Finally, should we include our execution time header?
		if ( defined( 'PAULUS_ALLOW_BENCHMARK_HEADER' ) === true ) {
			// If our benchmark header is set to true
			if ( $this->request->header( PAULUS_BENCHMARK_HEADER_NAME, false ) ) {
				// Set our benchmark header to the time difference between the app start and now
				$this->response->header(
					PAULUS_BENCHMARK_HEADER_NAME,
					( microtime( true) - PAULUS_START_TIME )
				);
			}
		}
		// If its been flagged to always show
		elseif ( defined( 'PAULUS_BENCHMARK_ALWAYS' ) === true ) {
			// Set our benchmark header to the time difference between the app start and now
			$this->response->header(
				PAULUS_BENCHMARK_HEADER_NAME,
				( microtime( true) - PAULUS_START_TIME )
			);
		}

		// We need to EXIT here, since we want this to be our last output
		// ... but be able to turn it off...
		if ( isset( $this->config['rest']['exit_after_rest_response'] ) && $this->config['rest']['exit_after_rest_response'] ) {
			exit;
		}
	}
214299
protected function getType($response)
    {
        if (!$response) {
            return;
        }

        if (array_key_exists('intent', $response)) {
            // 'sale' for payment request / execute
            return $response['intent'];
        }

        if (array_key_exists('url', $response) && array_key_exists('event_types', $response)) {
            return 'webhook';
        }
    }
1120083
public function getType() : ?string
    {
        if (null === $this->type) {
            $success = null;

            try {
                $type = $this->getItem('browscap.type', false, $success);
            } catch (InvalidArgumentException $e) {
                $this->logger->error(new \InvalidArgumentException('an error occured while reading the data type from the cache', 0, $e));
                $type = null;
            }

            if (null !== $type && $success) {
                $this->type = $type;
            }
        }

        return $this->type;
    }
1298803
public function getSortType()
    {
        $sortType = isset($this->requestParams[self::PARAM_SORT_TYPE]) ?
            $this->requestParams[self::PARAM_SORT_TYPE] : self::DEFAULT_SORT_TYPE;
        $sortType= mb_strtolower($sortType);

        if(!in_array($sortType, ['string', 'numeric'])) {
            $sortType = self::DEFAULT_SORT_TYPE;
        }

        return $sortType;
    }
631781
protected static function isHtmlResponse () {
		$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
		$request = & $app->GetRequest();
		if ($request->IsInternalRequest()) return FALSE;
		$response = & $app->GetResponse();
		return $response->HasHeader('Content-Type') && $response->IsHtmlOutput();
	}
14392
public function decodeFromUrlParams()
    {
        if (strpos($this->body, '=') !== false) {
            parse_str($this->body, $parsed);
        }

        if (empty($parsed)) {
            throw new UnexpectedResponseFormatException($this);
        }

        return $parsed;
    }
281719
public function getType()
    {
        if($this->_type == null) {
            $this->_type = parse_url($this->_path, PHP_URL_HOST);
        }

        return $this->_type;
    }
595284
public function getLinkType()
    {
        $types = $this->config()->get('types');
        return isset($types[$this->Type]) ? _t('Links.TYPE'.strtoupper($this->Type), $types[$this->Type]) : null;
    }