Exemplo n.º 1
0
 /**
  * Start the coroutine.
  *
  * @param StrandInterface $strand The strand that is executing the coroutine.
  */
 public function call(StrandInterface $strand)
 {
     $strand->suspend();
     $this->promise->then(function ($value) use($strand) {
         if ($this->promise) {
             $strand->resumeWithValue($value);
         }
     }, function ($reason) use($strand) {
         if ($this->promise) {
             $strand->resumeWithException($this->adaptReasonToException($reason));
         }
     });
 }