File tree 1 file changed +5
-8
lines changed 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,13 @@ public function addTimer($interval, $callback)
137
137
{
138
138
$ timer = new Timer ($ interval , $ callback , false );
139
139
140
- $ callback = function () use ($ timer ) {
140
+ $ that = $ this ;
141
+ $ timers = $ this ->timers ;
142
+ $ callback = function () use ($ timer , $ timers , $ that ) {
141
143
call_user_func ($ timer ->getCallback (), $ timer );
142
144
143
- if ($ this -> isTimerActive ($ timer )) {
144
- $ this ->cancelTimer ($ timer );
145
+ if ($ timers -> contains ($ timer )) {
146
+ $ that ->cancelTimer ($ timer );
145
147
}
146
148
};
147
149
@@ -176,11 +178,6 @@ public function cancelTimer(TimerInterface $timer)
176
178
$ this ->timers ->detach ($ timer );
177
179
}
178
180
179
- public function isTimerActive (TimerInterface $ timer )
180
- {
181
- return $ this ->timers ->contains ($ timer );
182
- }
183
-
184
181
public function futureTick ($ listener )
185
182
{
186
183
$ this ->futureTickQueue ->add ($ listener );
You can’t perform that action at this time.
0 commit comments