Example #1
0
 /**
  */
 private function onTick()
 {
     try {
         $this->lastResult = $this->task->__invoke($this);
         ++$this->iterations;
         if ($this->timer->isPeriodic()) {
             $this->deferred()->notify($this->lastResult);
             if ($this->maxIterations() !== null && $this->iterations() >= $this->maxIterations()) {
                 $this->cancel();
             }
         } else {
             $this->deferred()->resolve($this->lastResult);
         }
     } catch (\Exception $e) {
         $this->deferred()->reject($e);
         $this->timer->cancel();
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function notify($state = null)
 {
     $this->notify->__invoke($state);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function compare($a, $b)
 {
     return $this->callbackDelegate->__invoke($a, $b);
 }
 /**
  * {@inheritdoc}
  */
 public function equals($a, $b)
 {
     return $this->callbackDelegate->__invoke($a, $b);
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function compare($a, $b)
 {
     return $this->direction()->value() * parent::compare($this->selector->__invoke($a), $this->selector->__invoke($b));
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function apply($value)
 {
     return $this->callbackDelegate->__invoke($value);
 }
Example #7
0
 /**
  * @return static
  */
 public function createQueryBuilder()
 {
     return $this->factory->__invoke();
 }