public function getRenamedCommand($command)
{
static $map;
// Command renaming not enabled
if ($this->renamedCommands === NULL) {
return $command;
}
// Initialize command map
if ($map === NULL) {
if (is_array($this->renamedCommands)) {
$map = $this->renamedCommands;
} else {
$map = array();
}
}
// Generate and return cached result
if (!isset($map[$command])) {
// String means all commands are hashed with salted md5
if (is_string($this->renamedCommands)) {
$map[$command] = md5($this->renamedCommands . $command);
} else {
if (is_array($this->renamedCommands)) {
return $command;
} else {
if (is_callable($this->renamedCommands)) {
$map[$command] = call_user_func($this->renamedCommands, $command);
}
}
}
}
return $map[$command];
}