mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
UrlParams: Allow conversion to an associative array
This commit is contained in:
parent
ca678a57e9
commit
68be11b929
@ -374,9 +374,29 @@ class UrlParams
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
/**
|
||||
* Return the parameters of this url as sequenced or associative array
|
||||
*
|
||||
* @param bool $sequenced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($sequenced = true)
|
||||
{
|
||||
return $this->params;
|
||||
if ($sequenced) {
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
$params = array();
|
||||
foreach ($this->params as $param) {
|
||||
if ($param[1] === true) {
|
||||
$params[] = $param[0];
|
||||
} else {
|
||||
$params[$param[0]] = $param[1];
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function toString($separator = null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user