public function setOption(string $option, $value)
{
switch ($option) {
case "maxBytesPerMinute":
if (8192 > $value) {
throw new \DomainException("{$option} must be at least 8192 bytes");
}
case "autoFrameSize":
case "maxFrameSize":
case "maxFramesPerSecond":
case "maxMsgSize":
case "heartbeatPeriod":
case "closePeriod":
case "queuedPingLimit":
if (0 <= ($value = filter_var($value, FILTER_VALIDATE_INT))) {
throw new \DomainException("{$option} must be a positive integer greater than 0");
}
break;
case "validateUtf8":
case "textOnly":
if (null === ($value = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
throw new \DomainException("{$option} must be a boolean value");
}
break;
default:
throw new \DomainException("Unknown option {$option}");
}
$this->{$option} = $value;
}