Add method set/getByRef to Icinga\Web\Session\SessionNamespace
This commit is contained in:
parent
80c42ce499
commit
efab6c7827
|
@ -126,6 +126,17 @@ class SessionNamespace implements IteratorAggregate
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setByRef($key, &$value)
|
||||
{
|
||||
$this->values[$key] = $value;
|
||||
|
||||
if (in_array($key, $this->removed)) {
|
||||
unset($this->removed[array_search($key, $this->removed)]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for session values
|
||||
*
|
||||
|
@ -139,6 +150,16 @@ class SessionNamespace implements IteratorAggregate
|
|||
return isset($this->values[$key]) ? $this->values[$key] : $default;
|
||||
}
|
||||
|
||||
public function & getByRef($key, $default = null)
|
||||
{
|
||||
$value = $default;
|
||||
if (isset($this->values[$key])) {
|
||||
$value = & $this->values[$key];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given value from the session
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue