Predis\Cluster\ClusterStrategy::setCommandHandler PHP 메소드

setCommandHandler() 공개 메소드

The signature of the callback must have a single parameter of type Predis\Command\CommandInterface. When the callback argument is omitted or NULL, the previously associated handler for the specified command ID is removed.
public setCommandHandler ( string $commandID, mixed $callback = null )
$commandID string Command ID.
$callback mixed A valid callable object, or NULL to unset the handler.
    public function setCommandHandler($commandID, $callback = null)
    {
        $commandID = strtoupper($commandID);
        if (!isset($callback)) {
            unset($this->commands[$commandID]);
            return;
        }
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('The argument must be a callable object or NULL.');
        }
        $this->commands[$commandID] = $callback;
    }