mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
格式化代码
This commit is contained in:
@@ -90,7 +90,7 @@ class Console
|
|||||||
|
|
||||||
$exitCode = $e->getCode();
|
$exitCode = $e->getCode();
|
||||||
if (is_numeric($exitCode)) {
|
if (is_numeric($exitCode)) {
|
||||||
$exitCode = (int) $exitCode;
|
$exitCode = (int)$exitCode;
|
||||||
if (0 === $exitCode) {
|
if (0 === $exitCode) {
|
||||||
$exitCode = 1;
|
$exitCode = 1;
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ class Console
|
|||||||
*/
|
*/
|
||||||
public function setCatchExceptions($boolean)
|
public function setCatchExceptions($boolean)
|
||||||
{
|
{
|
||||||
$this->catchExceptions = (bool) $boolean;
|
$this->catchExceptions = (bool)$boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -211,7 +211,7 @@ class Console
|
|||||||
*/
|
*/
|
||||||
public function setAutoExit($boolean)
|
public function setAutoExit($boolean)
|
||||||
{
|
{
|
||||||
$this->autoExit = (bool) $boolean;
|
$this->autoExit = (bool)$boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -606,19 +606,19 @@ class Console
|
|||||||
|
|
||||||
if ('\\' === DS) {
|
if ('\\' === DS) {
|
||||||
if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
|
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)) {
|
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 ($sttyString = $this->getSttyColumns()) {
|
||||||
if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
|
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)) {
|
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'])) {
|
if (true === $input->hasParameterOption(['--quiet', '-q'])) {
|
||||||
$output->setVerbosity(Output::VERBOSITY_QUIET);
|
$output->setVerbosity(Output::VERBOSITY_QUIET);
|
||||||
} else {
|
} else {
|
||||||
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3')
|
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
|
||||||
|| $input->getParameterOption('--verbose') === 3
|
|
||||||
) {
|
|
||||||
$output->setVerbosity(Output::VERBOSITY_DEBUG);
|
$output->setVerbosity(Output::VERBOSITY_DEBUG);
|
||||||
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2')
|
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
|
||||||
|| $input->getParameterOption('--verbose') === 2
|
|
||||||
) {
|
|
||||||
$output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE);
|
$output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE);
|
||||||
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1')
|
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
|
||||||
|| $input->hasParameterOption('--verbose')
|
|
||||||
|| $input->getParameterOption('--verbose')
|
|
||||||
) {
|
|
||||||
$output->setVerbosity(Output::VERBOSITY_VERBOSE);
|
$output->setVerbosity(Output::VERBOSITY_VERBOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ class Error
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::getExceptionHandler()->report($e);
|
self::getExceptionHandler()->report($e);
|
||||||
if(IS_CLI){
|
if (IS_CLI) {
|
||||||
self::getExceptionHandler()->renderForConsole(new ConsoleOutput, $e);
|
self::getExceptionHandler()->renderForConsole(new ConsoleOutput, $e);
|
||||||
}else{
|
} else {
|
||||||
self::getExceptionHandler()->render($e)->send();
|
self::getExceptionHandler()->render($e)->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,12 +77,7 @@ class Error
|
|||||||
{
|
{
|
||||||
if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) {
|
if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) {
|
||||||
// 将错误信息托管至think\ErrorException
|
// 将错误信息托管至think\ErrorException
|
||||||
$exception = new ErrorException(
|
$exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']);
|
||||||
$error['type'],
|
|
||||||
$error['message'],
|
|
||||||
$error['file'],
|
|
||||||
$error['line']
|
|
||||||
);
|
|
||||||
|
|
||||||
self::appException($exception);
|
self::appException($exception);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user