Skip to content

Commit

Permalink
collect called listeners information only once
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jun 25, 2019
1 parent 57d73fc commit 2ad32df
Showing 1 changed file with 9 additions and 12 deletions.
Expand Up @@ -191,21 +191,18 @@ public function getNotCalledListeners()
return [];
}

$calledListeners = [];

if (null !== $this->callStack) {
foreach ($this->callStack as $calledListener) {
$calledListeners[] = $calledListener->getWrappedListener();
}
}

$notCalled = [];
foreach ($allListeners as $eventName => $listeners) {
foreach ($listeners as $listener) {
$called = false;
if (null !== $this->callStack) {
foreach ($this->callStack as $calledListener) {
if ($calledListener->getWrappedListener() === $listener) {
$called = true;

break;
}
}
}

if (!$called) {
if (!\in_array($listener, $calledListeners, true)) {
if (!$listener instanceof WrappedListener) {
$listener = new WrappedListener($listener, null, $this->stopwatch, $this);
}
Expand Down

0 comments on commit 2ad32df

Please sign in to comment.