去除 MODULE_NAME CONTROLLER_NAME ACTION_NAME 常量

This commit is contained in:
thinkphp
2016-06-01 18:34:36 +08:00
parent 4a4c53bf6b
commit ac0cb9be42
11 changed files with 123 additions and 59 deletions

View File

@@ -38,7 +38,7 @@ class Console
private $runningCommand;
private $catchExceptions = true;
private $autoExit = true;
private $autoExit = true;
private $definition;
private $helperSet;
private $terminalDimensions;
@@ -49,7 +49,7 @@ class Console
"think\\console\\command\\Lists",
"think\\console\\command\\Build",
"think\\console\\command\\make\\Controller",
"think\\console\\command\\make\\Model"
"think\\console\\command\\make\\Model",
];
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
@@ -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;
}
/**
@@ -379,7 +379,7 @@ class Console
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
return preg_quote($matches[1]) . '[^:]*';
}, $namespace);
$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
if (empty($namespaces)) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -417,7 +417,7 @@ class Console
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
return preg_quote($matches[1]) . '[^:]*';
}, $name);
$commands = preg_grep('{^' . $expr . '}', $allCommands);
$commands = preg_grep('{^' . $expr . '}', $allCommands);
if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
if (false !== $pos = strrpos($name, ':')) {
@@ -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]];
}
}