{
// $params[0] -> the layer
if ($error = $this->_checkLayer(@$params[0])) {
- $failmsg .= $error;
- break;
+ return $this->raiseError($error);
}
$keys = $this->config->getKeys();
sort($keys);
// $params[0] -> the parameter
// $params[1] -> the layer
if ($error = $this->_checkLayer(@$params[1])) {
- $failmsg .= $error;
- break;
+ return $this->raiseError($error);
}
if (sizeof($params) < 1 || sizeof($params) > 2) {
- $failmsg .= "config-get expects 1 or 2 parameters";
+ return $this->raiseError("config-get expects 1 or 2 parameters");
} elseif (sizeof($params) == 1) {
$this->ui->displayLine("$params[0] = " . $this->config->get($params[0]));
} else {
// $param[1] -> the value for the parameter
// $param[2] -> the layer
$failmsg = '';
- if (sizeof($params) < 2 || sizeof($params) > 3) {
- $failmsg .= "config-set expects 2 or 3 parameters";
- break;
- }
- if ($error = $this->_checkLayer(@$params[2])) {
- $failmsg .= $error;
- break;
- }
- if (!call_user_func_array(array(&$this->config, 'set'), $params))
- {
- $failmsg = "config-set (" . implode(", ", $params) . ") failed";
- } else {
- $this->config->store();
- }
+ do {
+ if (sizeof($params) < 2 || sizeof($params) > 3) {
+ $failmsg .= "config-set expects 2 or 3 parameters";
+ break;
+ }
+ if ($error = $this->_checkLayer(@$params[2])) {
+ $failmsg .= $error;
+ break;
+ }
+ if (!call_user_func_array(array(&$this->config, 'set'), $params))
+ {
+ $failmsg = "config-set (" . implode(", ", $params) . ") failed";
+ } else {
+ $this->config->store();
+ }
+ } while (false);
if ($failmsg) {
return $this->raiseError($failmsg);
}