/** * Порождает объект класса React\Promise. * * @return mixed Возвращает React\Promise * * @throws \Exception если результатом запроса уже является Future */ public function promise() { if ($this->future) { throw new \Exception("You could not give promise when future is in!"); } if ($this->promise) { return $this->promise; } return $this->promise = Promise::create($this->stream, $this->onResolve); }