Skip to content

Commit e46a45e

Browse files
committed
some update, some waring fixed
1 parent 98079d4 commit e46a45e

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

README_zh.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
- 颜色风格输出支持
88
- 特殊格式信息显示
99
- 用户信息交互支持
10+
- 其他功能
1011

1112
## 项目地址
1213

13-
- **git@osc** https://git.oschina.net/inhere/php-console.git
1414
- **github** https://github.com/inhere/php-console.git
15+
- **git@osc** https://git.oschina.net/inhere/php-console.git
1516

1617
## 安装
1718

src/AbstractApp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function config($name, $default = null)
273273
if (strpos($name, '.') > 1) {
274274
[$topKey, $subKey] = explode('.', $name, 2);
275275

276-
if (isset($this->config[$topKey]) && isset($this->config[$topKey][$subKey])) {
276+
if (isset($this->config[$topKey], $this->config[$topKey][$subKey])) {
277277
return $this->config[$topKey][$subKey];
278278
}
279279
}

src/io/InputInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
namespace inhere\console\io;
1010

11-
use inhere\console\Helper;
12-
use inhere\console\style\Style;
13-
use inhere\console\utils\Interact;
14-
1511
/**
1612
* Class Input
1713
* @package inhere\console\io

src/io/OutputInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
namespace inhere\console\io;
1010

11-
use inhere\console\Helper;
12-
use inhere\console\style\Style;
13-
use inhere\console\utils\Interact;
14-
1511
/**
1612
* Class OutputInterface
1713
* @package inhere\console\io

src/style/LiteStyle.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,20 @@ public static function add($text, $style = self::NORMAL)
7979
{
8080
return self::render($text, $style);
8181
}
82+
83+
/**
84+
* @param $text
85+
* @param string|int|array $style
86+
* @return string
87+
*/
8288
public static function render($text, $style = self::NORMAL)
8389
{
8490
if (!Helper::isSupportColor()) {
8591
return $text;
8692
}
8793

8894
if(is_string($style)) {
89-
$out = isset(self::$styles[$style]) ? self::$styles[$style] : self::NORMAL;
95+
$out = self::$styles[$style] ?? self::NORMAL;
9096
} elseif (is_int($style)) {
9197
$out = $style;
9298

@@ -98,9 +104,7 @@ public static function render($text, $style = self::NORMAL)
98104
}
99105

100106
// $result = chr(27). "$out{$text}" . chr(27) . chr(27) . "[0m". chr(27);
101-
$result = "\033[{$out}m{$text}\033[0m";
102-
103-
return $result;
107+
return "\033[{$out}m{$text}\033[0m";
104108
}
105109

106110
/**

0 commit comments

Comments
 (0)