mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
ExtensibleSet: allow global "set"
This commit is contained in:
parent
f97e117994
commit
013cc1c67d
@ -57,6 +57,28 @@ class ExtensibleSet
|
|||||||
return $set;
|
return $set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function set($set)
|
||||||
|
{
|
||||||
|
if (is_array($set) || is_string($set)) {
|
||||||
|
$this->reset();
|
||||||
|
$this->override($set);
|
||||||
|
} elseif (is_object($set)) {
|
||||||
|
$this->reset();
|
||||||
|
|
||||||
|
foreach (array('override', 'extend', 'blacklist') as $method) {
|
||||||
|
if (property_exists($set, $method)) {
|
||||||
|
$this->$method($set->$method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ProgrammingError(
|
||||||
|
'ExtensibleSet::set accepts only plain arrays or objects'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function hasBeenLoadedFromDb()
|
public function hasBeenLoadedFromDb()
|
||||||
{
|
{
|
||||||
return $this->fromDb !== null;
|
return $this->fromDb !== null;
|
||||||
@ -277,7 +299,7 @@ class ExtensibleSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasBeenResolved()) {
|
if ($this->hasBeenResolved()) {
|
||||||
$this->reset();
|
$this->resolvedValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->inheritedValues = array();
|
$this->inheritedValues = array();
|
||||||
@ -449,7 +471,11 @@ class ExtensibleSet
|
|||||||
|
|
||||||
protected function reset()
|
protected function reset()
|
||||||
{
|
{
|
||||||
|
$this->ownValues = null;
|
||||||
|
$this->plusValues = array();
|
||||||
|
$this->minusValues = array();
|
||||||
$this->resolvedValues = null;
|
$this->resolvedValues = null;
|
||||||
|
$this->inheritedValues = array();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user