Exemplo n.º 1
0
 protected function executeDelayedCall($function, $args, $errorResultCode, Deferred $deferred)
 {
     $this->register();
     $args[] = EIO_PRI_DEFAULT;
     $args[] = function ($data, $result, $req) use($deferred, $errorResultCode, $function, $args) {
         if ($result == $errorResultCode) {
             $exception = new UnexpectedValueException(@eio_get_last_error($req));
             $exception->setArgs($args);
             $deferred->reject($exception);
             return;
         }
         $deferred->resolve($result);
     };
     if (!call_user_func_array($function, $args)) {
         $name = $function;
         if (!is_string($function)) {
             $name = get_class($function);
         }
         $exception = new RuntimeException('Unknown error calling "' . $name . '"');
         $exception->setArgs($args);
         $deferred->reject($exception);
     }
 }