public function setVolume($volume)
    {
        $deferred = new Deferred();

        if ($volume > 100 || $volume < 0) {
            $deferred->reject(new \InvalidArgumentException("{$volume}% is not a valid option. The bitrate must be between 0% and 100%."));

            return $deferred->promise();
        }

        if ($this->speaking) {
            $deferred->reject(new \Exception('Cannot change volume while playing.'));

            return $deferred->promise();
        }

        $this->volume = $volume;

        $deferred->resolve();

        return $deferred->promise();
    }
public function setVolume($volume)
    {
        $deferred = new Deferred();

        if ($volume > 100 || $volume < 0) {
            $deferred->reject(new \InvalidArgumentException("{$volume}% is not a valid option. The bitrate must be between 0% and 100%."));

            return $deferred->promise();
        }

        if ($this->speaking) {
            $deferred->reject(new \Exception('Cannot change volume while playing.'));

            return $deferred->promise();
        }

        $this->volume = $volume;

        $deferred->resolve();

        return $deferred->promise();
    }
public function setVolume ( $ volume ) { $ deferred = new Deferred ( ) ; if ( $ volume > 100 || $ volume < 0 ) { $ deferred -> reject ( new \ InvalidArgumentException ( "{$volume}% is not a valid option. The bitrate must be between 0% and 100%." ) ) ; return $ deferred -> promise ( ) ; } if ( $ this -> speaking ) { $ deferred -> reject ( new \ Exception ( 'Cannot change volume while playing.' ) ) ; return $ deferred -> promise ( ) ; } $ this -> volume = $ volume ; $ deferred -> resolve ( ) ; return $ deferred -> promise ( ) ; }
Sets the volume.

@param int $volume The volume to set.

@return \React\Promise\Promise
Sets the volume .