8000 Remove ExtEvLoop::isTimerActive. · reactphp/event-loop@882597b · GitHub
[go: up one dir, main page]

Skip to content

Commit 882597b

Browse files
committed
Remove ExtEvLoop::isTimerActive.
1 parent 43dc6ac commit 882597b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/ExtEvLoop.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ public function addTimer($interval, $callback)
137137
{
138138
$timer = new Timer($interval, $callback, false);
139139

140-
$callback = function () use ($timer) {
140+
$that = $this;
141+
$timers = $this->timers;
142+
$callback = function () use ($timer, $timers, $that) {
141143
call_user_func($timer->getCallback(), $timer);
142144

143-
if ($this->isTimerActive($timer)) {
144-
$this->cancelTimer($timer);
145+
if ($timers->contains($timer)) {
146+
$that->cancelTimer($timer);
145147
}
146148
};
147149

@@ -176,11 +178,6 @@ public function cancelTimer(TimerInterface $timer)
176178
$this->timers->detach($timer);
177179
}
178180

179-
public function isTimerActive(TimerInterface $timer)
180-
{
181-
return $this->timers->contains($timer);
182-
}
183-
184181
public function futureTick($listener)
185182
{
186183
$this->futureTickQueue->add($listener);

0 commit comments

Comments
 (0)
0