代码规范化

This commit is contained in:
thinkphp
2016-08-09 10:35:06 +08:00
parent 8b147f6895
commit 131aaf1357
18 changed files with 60 additions and 75 deletions

View File

@@ -11,8 +11,8 @@
namespace think\console;
use think\console\input\Definition;
use think\console\input\Argument;
use think\console\input\Definition;
use think\console\input\Option;
class Input
@@ -38,7 +38,6 @@ class Input
private $tokens;
private $parsed;
public function __construct($argv = null)
{
if (null === $argv) {
@@ -52,7 +51,6 @@ class Input
$this->definition = new Definition();
}
protected function setTokens(array $tokens)
{
$this->tokens = $tokens;
@@ -71,7 +69,6 @@ class Input
$this->parse();
}
/**
* 解析参数
*/
@@ -94,7 +91,6 @@ class Input
}
}
/**
* 解析短选项
* @param string $token 当前的指令.
@@ -178,7 +174,6 @@ class Input
}
}
/**
* 添加一个短选项的值
* @param string $shortcut 短名称
@@ -260,7 +255,6 @@ class Input
return null;
}
/**
* 检查原始参数是否包含某个值
* @param string|array $values 需要检查的值
@@ -268,7 +262,7 @@ class Input
*/
public function hasParameterOption($values)
{
$values = (array)$values;
$values = (array) $values;
foreach ($this->tokens as $token) {
foreach ($values as $value) {
@@ -289,7 +283,7 @@ class Input
*/
public function getParameterOption($values, $default = false)
{
$values = (array)$values;
$values = (array) $values;
$tokens = $this->tokens;
while (0 < count($tokens)) {
@@ -309,7 +303,6 @@ class Input
return $default;
}
/**
* 验证输入
* @throws \RuntimeException
@@ -336,7 +329,7 @@ class Input
*/
public function setInteractive($interactive)
{
$this->interactive = (bool)$interactive;
$this->interactive = (bool) $interactive;
}
/**
@@ -459,7 +452,7 @@ class Input
return $match[1] . $this->escapeToken($match[2]);
}
if ($token && $token[0] !== '-') {
if ($token && '-' !== $token[0]) {
return $this->escapeToken($token);
}
@@ -468,4 +461,4 @@ class Input
return implode(' ', $tokens);
}
}
}