Predis\Command\Processor\KeyPrefixProcessor::setCommandHandler PHP Метод

setCommandHandler() публичный Метод

The callback signature must have 2 parameters of the following types: - Predis\Command\CommandInterface (command instance) - String (prefix) 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 The ID of the command to be handled.
$callback mixed A valid callable object or NULL.
    public function setCommandHandler($commandID, $callback = null)
    {
        $commandID = strtoupper($commandID);
        if (!isset($callback)) {
            unset($this->commands[$commandID]);
            return;
        }
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('Callback must be a valid callable object or NULL');
        }
        $this->commands[$commandID] = $callback;
    }