Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
PathInfo Class Reference

Public Member Functions

 getPathInfo (string $requestUri, string $baseUrl)
 
 getQueryString (string $requestUri)
 

Detailed Description

Computes path info and query string from request

Definition at line 13 of file PathInfo.php.

Member Function Documentation

◆ getPathInfo()

getPathInfo ( string  $requestUri,
string  $baseUrl 
)

Get path info using from the request URI and base URL

Parameters
string$requestUri
string$baseUrl
Returns
string

Definition at line 22 of file PathInfo.php.

22  : string
23  {
24  if ($requestUri === '/') {
25  return '';
26  }
27 
28  $requestUri = $this->removeRepeatedSlashes($requestUri);
29  $parsedRequestUri = explode('?', $requestUri, 2);
30  $pathInfo = (string)substr(current($parsedRequestUri), (int)strlen($baseUrl));
31 
32  if ($this->isNoRouteUri($baseUrl, $pathInfo)) {
34  }
35  return $pathInfo;
36  }

◆ getQueryString()

getQueryString ( string  $requestUri)

Get query string using from the request URI

Parameters
string$requestUri
Returns
string

Definition at line 44 of file PathInfo.php.

44  : string
45  {
46  $requestUri = $this->removeRepeatedSlashes($requestUri);
47  $parsedRequestUri = explode('?', $requestUri, 2);
48  $queryString = !isset($parsedRequestUri[1]) ? '' : '?' . $parsedRequestUri[1];
49  return $queryString;
50  }

The documentation for this class was generated from the following file: