Fixed unregister-functions in CallbackManager (#199)

* ServerUIPropertiesMenu for Configurator to edit builtin UIProperties of MP

* fixed unregister-functions of CallbackManager
This commit is contained in:
axelalex2 2018-11-16 18:53:16 +01:00 committed by Lukas Kremsmayr
parent 8c2ae55d97
commit 37ae2a62c2

View File

@ -179,9 +179,9 @@ class CallbackManager implements UsageInformationAble {
private function removeCallbackListener(array &$listeningsArray, CallbackListener $listener) { private function removeCallbackListener(array &$listeningsArray, CallbackListener $listener) {
$removed = false; $removed = false;
foreach ($listeningsArray as &$listenings) { foreach ($listeningsArray as &$listenings) {
foreach ($listenings as $key => &$listening) { foreach ($listenings as $i => $listening) {
if ($listening->listener === $listener) { if ($listening->listener === $listener) {
unset($listenings[$key]); array_splice($listenings, $i, 1);
$removed = true; $removed = true;
} }
} }
@ -198,10 +198,10 @@ class CallbackManager implements UsageInformationAble {
*/ */
public function unregisterCallbackListening($callbackName, CallbackListener $listener) { public function unregisterCallbackListening($callbackName, CallbackListener $listener) {
$removed = false; $removed = false;
foreach ($this->callbackListenings as &$listenings) { foreach ($this->callbackListenings as $callbackKey => &$listenings) {
foreach ($listenings as $key => &$listening) { foreach ($listenings as $i => $listening) {
if ($key === $callbackName && $listening->listener === $listener) { if ($callbackKey === $callbackName && $listening->listener === $listener) {
unset($listenings[$key]); array_splice($listenings, $i, 1);
$removed = true; $removed = true;
} }
} }