You are here

public static function Utility::parseRequestParams in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::parseRequestParams()

Parses the request params.

In opposite to parse_str() the same param could occur multiple times.

Parameters

\Solarium\Core\Client\Request $request: The Solarium request.

Return value

array An associative array of parameters.

3 calls to Utility::parseRequestParams()
BasicAuthTestSolrCloudConnector::getRequestParams in tests/modules/search_api_solr_test/src/Plugin/SolrConnector/BasicAuthTestSolrCloudConnector.php
Gets the Solarium request parameters.
BasicAuthTestSolrConnector::getRequestParams in tests/modules/search_api_solr_test/src/Plugin/SolrConnector/BasicAuthTestSolrConnector.php
Gets the Solarium request parameters.
SolariumRequestLogger::preExecuteRequest in modules/search_api_solr_devel/src/Logging/SolariumRequestLogger.php
Dumps a Solr query as drupal messages.

File

src/Utility/Utility.php, line 483

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function parseRequestParams(Request $request) {
  $params = [];
  $parameters = $request
    ->getMethod() === 'GET' ? explode('&', $request
    ->getQueryString()) : explode('&', $request
    ->getRawData());
  foreach ($parameters as $parameter) {
    if ($parameter) {
      if (strpos($parameter, '=')) {
        list($name, $value) = explode('=', $parameter);
        $params[urldecode($name)][] = urldecode($value);
      }
      else {
        $params[urldecode($parameter)][] = '';
      }
    }
  }
  return $params;
}