Core/src/LongRunning/LongRunningOperation.php
public function state(array $options = [])
    {
        if (!$this->done($options)) {
            return self::STATE_IN_PROGRESS;
        }

        if ($this->done() && $this->result()) {
            return self::STATE_SUCCESS;
        }

        return self::STATE_ERROR;
    }
public function state(array $options = [])
    {
        if (!$this->done($options)) {
            return self::STATE_IN_PROGRESS;
        }

        if ($this->done() && $this->result()) {
            return self::STATE_SUCCESS;
        }

        return self::STATE_ERROR;
    }
public function state ( array $ options = [ ] ) { if ( ! $ this -> done ( $ options ) ) { return self :: STATE_IN_PROGRESS ; } if ( $ this -> done ( ) && $ this -> result ( ) ) { return self :: STATE_SUCCESS ; } return self :: STATE_ERROR ; }
Get the state of the Operation.

Return value will be one of `LongRunningOperation::STATE_IN_PROGRESS`,
`LongRunningOperation::STATE_SUCCESS` or
`LongRunningOperation::STATE_ERROR`.

If the Operation state is not available, a service request may be executed
by this method.

Example:
```
switch ($operation->state()) {
case LongRunningOperation::STATE_IN_PROGRESS:
echo "Operation is in progress";
break;

case LongRunningOperation::STATE_SUCCESS:
echo "Operation succeeded";
break;

case LongRunningOperation::STATE_ERROR:
echo "Operation failed";
break;
}
```

@param array $options [optional] Configuration options.
@return string
Get the state of the Operation .