Rx\Scheduler\VirtualTimeScheduler::__construct PHP Method

__construct() public method

public __construct ( integer $initialClock, callable $comparer )
$initialClock integer Initial value for the clock.
$comparer callable Comparer to determine causality of events based on absolute time.
    public function __construct($initialClock = 0, callable $comparer)
    {
        $this->clock = $initialClock;
        $this->comparer = $comparer;
        $this->queue = new PriorityQueue();
    }

Usage Example

Example #1
0
 /**
  * NewEventLoopScheduler constructor.
  * @param callable|LoopInterface $timerCallableOrLoop
  */
 public function __construct($timerCallableOrLoop)
 {
     // passing a loop directly into the scheduler will be deprecated in the next major release
     $this->timerCallable = $timerCallableOrLoop instanceof LoopInterface ? function ($ms, $callable) use($timerCallableOrLoop) {
         $timerCallableOrLoop->addTimer($ms / 1000, $callable);
     } : $timerCallableOrLoop;
     parent::__construct($this->now(), function ($a, $b) {
         return $a - $b;
     });
 }
All Usage Examples Of Rx\Scheduler\VirtualTimeScheduler::__construct