private function Uri::filterQuery in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::filterQuery()
Filter a query string to ensure it is propertly encoded.
Ensures that the values in the query string are properly urlencoded.
Parameters
string $query:
Return value
string
2 calls to Uri::filterQuery()
- Uri::parseUri in vendor/
zendframework/ zend-diactoros/ src/ Uri.php - Parse a URI into its parts, and set the properties
- Uri::withQuery in vendor/
zendframework/ zend-diactoros/ src/ Uri.php - Return an instance with the specified query string.
File
- vendor/
zendframework/ zend-diactoros/ src/ Uri.php, line 581
Class
- Uri
- Implementation of Psr\Http\UriInterface.
Namespace
Zend\DiactorosCode
private function filterQuery($query) {
if (!empty($query) && strpos($query, '?') === 0) {
$query = substr($query, 1);
}
$parts = explode('&', $query);
foreach ($parts as $index => $part) {
list($key, $value) = $this
->splitQueryValue($part);
if ($value === null) {
$parts[$index] = $this
->filterQueryOrFragment($key);
continue;
}
$parts[$index] = sprintf('%s=%s', $this
->filterQueryOrFragment($key), $this
->filterQueryOrFragment($value));
}
return implode('&', $parts);
}