__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.
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;
     });
 }
Example #2
0
 public function __construct()
 {
     parent::__construct(0, function ($a, $b) {
         return $a - $b;
     });
 }