Amp\Observer::getCurrent PHP Method

getCurrent() public method

Gets the last emitted value or throws an exception if the observable has completed.
public getCurrent ( ) : mixed
return mixed Value emitted from observable.
    public function getCurrent()
    {
        if (empty($this->values) && $this->resolved) {
            throw new \Error("The observable has resolved");
        }
        if (!\array_key_exists($this->position, $this->values)) {
            throw new \Error("Promise returned from next() must resolve before calling this method");
        }
        return $this->values[$this->position];
    }