public function isReadOperation(CommandInterface $command)
{
if (isset($this->disallowed[$id = $command->getId()])) {
throw new NotSupportedException("The command '{$id}' is not allowed in replication mode.");
}
if (isset($this->readonly[$id])) {
if (true === ($readonly = $this->readonly[$id])) {
return true;
}
return call_user_func($readonly, $command);
}
if (($eval = $id === 'EVAL') || $id === 'EVALSHA') {
$sha1 = $eval ? sha1($command->getArgument(0)) : $command->getArgument(0);
if (isset($this->readonlySHA1[$sha1])) {
if (true === ($readonly = $this->readonlySHA1[$sha1])) {
return true;
}
return call_user_func($readonly, $command);
}
}
return false;
}