Exemplo n.º 1
0
 public function callReturnSomeProgress($args, $argsKw, $details)
 {
     if (is_array($details) && isset($details['receive_progress']) && $details['receive_progress']) {
         $deferred = new \React\Promise\Deferred();
         $this->getLoop()->addTimer(1, function () use($deferred) {
             $deferred->progress(1);
         });
         $this->getLoop()->addTimer(2, function () use($deferred) {
             $deferred->progress(2);
         });
         $this->getLoop()->addTimer(3, function () use($deferred) {
             $deferred->resolve("DONE");
         });
         return $deferred->promise();
     } else {
         throw new \Exception("receive_progress option not set");
     }
 }