格式化代码

This commit is contained in:
yunwuxin
2016-05-15 10:15:19 +08:00
parent f78ba76767
commit 19d5b1fee9
2 changed files with 24 additions and 36 deletions

View File

@@ -90,7 +90,7 @@ class Console
$exitCode = $e->getCode();
if (is_numeric($exitCode)) {
$exitCode = (int) $exitCode;
$exitCode = (int)$exitCode;
if (0 === $exitCode) {
$exitCode = 1;
}
@@ -201,7 +201,7 @@ class Console
*/
public function setCatchExceptions($boolean)
{
$this->catchExceptions = (bool) $boolean;
$this->catchExceptions = (bool)$boolean;
}
/**
@@ -211,7 +211,7 @@ class Console
*/
public function setAutoExit($boolean)
{
$this->autoExit = (bool) $boolean;
$this->autoExit = (bool)$boolean;
}
/**
@@ -606,19 +606,19 @@ class Console
if ('\\' === DS) {
if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
return [(int) $matches[1], (int) $matches[2]];
return [(int)$matches[1], (int)$matches[2]];
}
if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
return [(int) $matches[1], (int) $matches[2]];
return [(int)$matches[1], (int)$matches[2]];
}
}
if ($sttyString = $this->getSttyColumns()) {
if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
return [(int) $matches[2], (int) $matches[1]];
return [(int)$matches[2], (int)$matches[1]];
}
if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
return [(int) $matches[2], (int) $matches[1]];
return [(int)$matches[2], (int)$matches[1]];
}
}
@@ -663,18 +663,11 @@ class Console
if (true === $input->hasParameterOption(['--quiet', '-q'])) {
$output->setVerbosity(Output::VERBOSITY_QUIET);
} else {
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3')
|| $input->getParameterOption('--verbose') === 3
) {
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
$output->setVerbosity(Output::VERBOSITY_DEBUG);
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2')
|| $input->getParameterOption('--verbose') === 2
) {
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
$output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE);
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1')
|| $input->hasParameterOption('--verbose')
|| $input->getParameterOption('--verbose')
) {
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
$output->setVerbosity(Output::VERBOSITY_VERBOSE);
}
}

View File

@@ -45,9 +45,9 @@ class Error
}
self::getExceptionHandler()->report($e);
if(IS_CLI){
if (IS_CLI) {
self::getExceptionHandler()->renderForConsole(new ConsoleOutput, $e);
}else{
} else {
self::getExceptionHandler()->render($e)->send();
}
}
@@ -77,12 +77,7 @@ class Error
{
if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) {
// 将错误信息托管至think\ErrorException
$exception = new ErrorException(
$error['type'],
$error['message'],
$error['file'],
$error['line']
);
$exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']);
self::appException($exception);
}