protected function _replaceVariable($input, $output, $variable)
{
$varienAdapterPhpFile = $this->_getVarienAdapterPhpFile();
$contents = file_get_contents($varienAdapterPhpFile);
$debugLinePattern = "/protected\\s" . '\\' . $variable . "\\s*?=\\s(false|true)/m";
preg_match($debugLinePattern, $contents, $matches);
if (!isset($matches[1])) {
throw new RuntimeException("Problem finding the \$_debug parameter");
}
$currentValue = $matches[1];
if ($input->getOption('off')) {
$newValue = 'false';
} elseif ($input->getOption('on')) {
$newValue = 'true';
} else {
$newValue = $currentValue == 'false' ? 'true' : 'false';
}
$output->writeln("<info>Changed <comment>" . $variable . "</comment> to <comment>" . $newValue . "</comment></info>");
$contents = preg_replace($debugLinePattern, "protected " . $variable . " = " . $newValue, $contents);
file_put_contents($varienAdapterPhpFile, $contents);
}