Url::add_url_parameter() & Url::add_url_parameters(): $url parameter is now not a reference

This commit is contained in:
Benjamin Renard 2023-03-01 10:40:00 +01:00
parent 2bf05291fe
commit 508dda6562
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -531,14 +531,14 @@ class Url {
/** /**
* Add parameter in specified URL * Add parameter in specified URL
* *
* @param string &$url The reference of the URL * @param string $url The URL
* @param string $parameter The parameter name * @param string $parameter The parameter name
* @param string $value The parameter value * @param string $value The parameter value
* @param boolean $encode Set if parameter value must be URL encoded (optional, default: true) * @param boolean $encode Set if parameter value must be URL encoded (optional, default: true)
* *
* @return string The completed URL * @return string The completed URL
*/ */
public static function add_url_parameter(&$url, $parameter, $value, $encode=true) { public static function add_url_parameter($url, $parameter, $value, $encode=true) {
if (strpos($url, '?') === false) if (strpos($url, '?') === false)
$url .= '?'; $url .= '?';
else else
@ -550,15 +550,15 @@ class Url {
/** /**
* Add parameters in specified URL * Add parameters in specified URL
* *
* @param string &$url The reference of the URL * @param string $url The URL
* @param array<string,string> $parameters The parameters as an associative array * @param array<string,string> $parameters The parameters as an associative array
* @param boolean $encode Set if parameters values must be URL encoded (optional, default: true) * @param boolean $encode Set if parameters values must be URL encoded (optional, default: true)
* *
* @return string The completed URL * @return string The completed URL
*/ */
public static function add_url_parameters(&$url, $parameters, $encode=true) { public static function add_url_parameters($url, $parameters, $encode=true) {
foreach($parameters as $parameter => $value) foreach($parameters as $parameter => $value)
self :: add_url_parameter($url, $parameter, $value, $encode); $url = self :: add_url_parameter($url, $parameter, $value, $encode);
return $url; return $url;
} }