Пример #1
0
 function stop($consumerId)
 {
     if ($this->instant) {
         $this->enabled = false;
     } else {
         if (isset($this->consumerTimers[$consumerId])) {
             clearInterval($this->consumerTimers[$consumerId]);
             unset($this->consumerTimers[$consumerId]);
         }
     }
 }
Пример #2
-5
 function testSetInterval()
 {
     $check = 0;
     $intervalId = null;
     $intervalId = setInterval(function () use(&$check, &$intervalId) {
         $check++;
         if ($check > 5) {
             clearInterval($intervalId);
         }
     }, 0.02);
     run();
     $this->assertEquals(6, $check);
 }