flushStack function re-factor
This commit is contained in:
parent
ac2576d991
commit
516d506f4e
@ -177,18 +177,25 @@ trait ManagesStacks
|
|||||||
$this->pushStack = [];
|
$this->pushStack = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush stack by key.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function flushStack($key = null)
|
public function flushStack($key = null)
|
||||||
{
|
{
|
||||||
if (array_key_exists($key, $this->pushes)) {
|
$properties = [
|
||||||
unset($this->pushes[$key]);
|
'pushes',
|
||||||
}
|
'prepends',
|
||||||
|
'pushStack',
|
||||||
|
];
|
||||||
|
|
||||||
if (array_key_exists($key, $this->prepends)) {
|
foreach ($properties as $property) {
|
||||||
unset($this->prepends[$key]);
|
if (!array_key_exists($key, $this->$property)) {
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists($key, $this->pushStack)) {
|
unset($this->$property[$key]);
|
||||||
unset($this->pushStack[$key]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user