Skip to content

Commit fa44b22

Browse files
committed
format all codes
1 parent a875abd commit fa44b22

File tree

8 files changed

+173
-173
lines changed

8 files changed

+173
-173
lines changed

phpunit.xml.dist

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
convertWarningsToExceptions="true"
1010
stopOnFailure="false"
1111
>
12-
<testsuites>
13-
<testsuite name="Php Library Test Suite">
14-
<directory>test/</directory>
15-
</testsuite>
16-
</testsuites>
12+
<testsuites>
13+
<testsuite name="Php Library Test Suite">
14+
<directory>test/</directory>
15+
</testsuite>
16+
</testsuites>
1717

18-
<filter>
19-
<whitelist>
20-
<directory suffix=".php">src</directory>
21-
</whitelist>
22-
</filter>
18+
<filter>
19+
<whitelist>
20+
<directory suffix=".php">src</directory>
21+
</whitelist>
22+
</filter>
2323
</phpunit>

src/Cli.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Cli
2020

2121
/**
2222
* @param mixed $message
23-
* @param bool $nl
23+
* @param bool $nl
2424
* @return string
2525
*/
2626
public static function read($message = null, $nl = false): string
@@ -34,7 +34,7 @@ public static function read($message = null, $nl = false): string
3434

3535
/**
3636
* write message to console
37-
* @param $messages
37+
* @param $messages
3838
* @param bool $nl
3939
* @param bool $quit
4040
*/
@@ -49,8 +49,8 @@ public static function write($messages, $nl = true, $quit = false)
4949

5050
/**
5151
* Logs data to stdout
52-
* @param string $message
53-
* @param bool $nl
52+
* @param string $message
53+
* @param bool $nl
5454
* @param bool|int $quit
5555
*/
5656
public static function stdout(string $message, $nl = true, $quit = false)
@@ -66,8 +66,8 @@ public static function stdout(string $message, $nl = true, $quit = false)
6666

6767
/**
6868
* Logs data to stderr
69-
* @param string $message
70-
* @param bool $nl
69+
* @param string $message
70+
* @param bool $nl
7171
* @param bool|int $quit
7272
*/
7373
public static function stderr(string $message, $nl = true, $quit = -1)
@@ -86,7 +86,7 @@ public static function stderr(string $message, $nl = true, $quit = -1)
8686
******************************************************************************/
8787

8888
/**
89-
* @param $text
89+
* @param $text
9090
* @param string|int|array $style
9191
* @return string
9292
*/
@@ -176,7 +176,7 @@ public static function isInteractive($fileDescriptor): bool
176176
* <value>
177177
* @link https://github.com/inhere/php-console/blob/master/src/io/Input.php
178178
* @param array $noValues List of parameters without values
179-
* @param bool $mergeOpts
179+
* @param bool $mergeOpts
180180
* @return array
181181
*/
182182
public static function parseArgv(array $noValues = [], $mergeOpts = false): array

src/Color.php

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -37,53 +37,53 @@ class Color
3737
const NORMAL = 0;
3838

3939
// Foreground color
40-
const FG_BLACK = 30;
41-
const FG_RED = 31;
42-
const FG_GREEN = 32;
43-
const FG_BROWN = 33; // like yellow
44-
const FG_BLUE = 34;
45-
const FG_CYAN = 36;
46-
const FG_WHITE = 37;
40+
const FG_BLACK = 30;
41+
const FG_RED = 31;
42+
const FG_GREEN = 32;
43+
const FG_BROWN = 33; // like yellow
44+
const FG_BLUE = 34;
45+
const FG_CYAN = 36;
46+
const FG_WHITE = 37;
4747
const FG_DEFAULT = 39;
4848

4949
// extra Foreground color
50-
const FG_DARK_GRAY = 90;
51-
const FG_LIGHT_RED = 91;
52-
const FG_LIGHT_GREEN = 92;
53-
const FG_LIGHT_YELLOW = 93;
54-
const FG_LIGHT_BLUE = 94;
50+
const FG_DARK_GRAY = 90;
51+
const FG_LIGHT_RED = 91;
52+
const FG_LIGHT_GREEN = 92;
53+
const FG_LIGHT_YELLOW = 93;
54+
const FG_LIGHT_BLUE = 94;
5555
const FG_LIGHT_MAGENTA = 95;
56-
const FG_LIGHT_CYAN = 96;
57-
const FG_WHITE_W = 97;
56+
const FG_LIGHT_CYAN = 96;
57+
const FG_WHITE_W = 97;
5858

5959
// Background color
60-
const BG_BLACK = 40;
61-
const BG_RED = 41;
62-
const BG_GREEN = 42;
63-
const BG_BROWN = 43; // like yellow
64-
const BG_BLUE = 44;
65-
const BG_CYAN = 46;
66-
const BG_WHITE = 47;
60+
const BG_BLACK = 40;
61+
const BG_RED = 41;
62+
const BG_GREEN = 42;
63+
const BG_BROWN = 43; // like yellow
64+
const BG_BLUE = 44;
65+
const BG_CYAN = 46;
66+
const BG_WHITE = 47;
6767
const BG_DEFAULT = 49;
6868

6969
// extra Background color
70-
const BG_DARK_GRAY = 100;
71-
const BG_LIGHT_RED = 101;
72-
const BG_LIGHT_GREEN = 102;
73-
const BG_LIGHT_YELLOW = 103;
74-
const BG_LIGHT_BLUE = 104;
70+
const BG_DARK_GRAY = 100;
71+
const BG_LIGHT_RED = 101;
72+
const BG_LIGHT_GREEN = 102;
73+
const BG_LIGHT_YELLOW = 103;
74+
const BG_LIGHT_BLUE = 104;
7575
const BG_LIGHT_MAGENTA = 105;
76-
const BG_LIGHT_CYAN = 106;
77-
const BG_WHITE_W = 107;
76+
const BG_LIGHT_CYAN = 106;
77+
const BG_WHITE_W = 107;
7878

7979
// color option
80-
const BOLD = 1; // 加粗
81-
const FUZZY = 2; // 模糊(不是所有的终端仿真器都支持)
82-
const ITALIC = 3; // 斜体(不是所有的终端仿真器都支持)
80+
const BOLD = 1; // 加粗
81+
const FUZZY = 2; // 模糊(不是所有的终端仿真器都支持)
82+
const ITALIC = 3; // 斜体(不是所有的终端仿真器都支持)
8383
const UNDERSCORE = 4; // 下划线
84-
const BLINK = 5; // 闪烁
85-
const REVERSE = 7; // 颠倒的 交换背景色与前景色
86-
const CONCEALED = 8; // 隐匿的
84+
const BLINK = 5; // 闪烁
85+
const REVERSE = 7; // 颠倒的 交换背景色与前景色
86+
const CONCEALED = 8; // 隐匿的
8787

8888
/**
8989
* some styles
@@ -92,65 +92,65 @@ class Color
9292
*/
9393
const STYLES = [
9494
// basic
95-
'red' => '0;31',
96-
'blue' => '0;34',
97-
'cyan' => '0;36',
98-
'black' => '0;30',
99-
'green' => '0;32',
100-
'brown' => '0;33',
101-
'white' => '1;37',
102-
'normal' => '39',// no color
103-
'yellow' => '1;33',
104-
'magenta' => '1;35',
95+
'red' => '0;31',
96+
'blue' => '0;34',
97+
'cyan' => '0;36',
98+
'black' => '0;30',
99+
'green' => '0;32',
100+
'brown' => '0;33',
101+
'white' => '1;37',
102+
'normal' => '39',// no color
103+
'yellow' => '1;33',
104+
'magenta' => '1;35',
105105

106106
// alert
107-
'suc' => '1;32',// same 'green' and 'bold'
108-
'success' => '1;32',
109-
'info' => '0;32',// same 'green'
110-
'comment' => '0;33',// same 'brown'
111-
'note' => '36;1',
112-
'notice' => '36;4',
113-
'warn' => '0;30;43',
114-
'warning' => '0;30;43',
115-
'danger' => '0;31',// same 'red'
116-
'err' => '30;41',
117-
'error' => '30;41',
107+
'suc' => '1;32',// same 'green' and 'bold'
108+
'success' => '1;32',
109+
'info' => '0;32',// same 'green'
110+
'comment' => '0;33',// same 'brown'
111+
'note' => '36;1',
112+
'notice' => '36;4',
113+
'warn' => '0;30;43',
114+
'warning' => '0;30;43',
115+
'danger' => '0;31',// same 'red'
116+
'err' => '30;41',
117+
'error' => '30;41',
118118

119119
// more
120-
'lightRed' => '1;31',
121-
'light_red' => '1;31',
122-
'lightGreen' => '1;32',
120+
'lightRed' => '1;31',
121+
'light_red' => '1;31',
122+
'lightGreen' => '1;32',
123123
'light_green' => '1;32',
124-
'lightBlue' => '1;34',
125-
'light_blue' => '1;34',
126-
'lightCyan' => '1;36',
127-
'light_cyan' => '1;36',
128-
'lightDray' => '37',
129-
'light_gray' => '37',
130-
131-
'darkDray' => '90',
132-
'dark_gray' => '90',
133-
'lightYellow' => '93',
134-
'light_yellow' => '93',
135-
'lightMagenta' => '95',
136-
'light_magenta' => '95',
124+
'lightBlue' => '1;34',
125+
'light_blue' => '1;34',
126+
'lightCyan' => '1;36',
127+
'light_cyan' => '1;36',
128+
'lightDray' => '37',
129+
'light_gray' => '37',
130+
131+
'darkDray' => '90',
132+
'dark_gray' => '90',
133+
'lightYellow' => '93',
134+
'light_yellow' => '93',
135+
'lightMagenta' => '95',
136+
'light_magenta' => '95',
137137

138138
// extra
139-
'lightRedEx' => '91',
140-
'light_red_ex' => '91',
141-
'lightGreenEx' => '92',
139+
'lightRedEx' => '91',
140+
'light_red_ex' => '91',
141+
'lightGreenEx' => '92',
142142
'light_green_ex' => '92',
143-
'lightBlueEx' => '94',
144-
'light_blue_ex' => '94',
145-
'lightCyanEx' => '96',
146-
'light_cyan_ex' => '96',
147-
'whiteEx' => '97',
148-
'white_ex' => '97',
143+
'lightBlueEx' => '94',
144+
'light_blue_ex' => '94',
145+
'lightCyanEx' => '96',
146+
'light_cyan_ex' => '96',
147+
'whiteEx' => '97',
148+
'white_ex' => '97',
149149

150150
// option
151-
'bold' => '1',
152-
'underscore' => '4',
153-
'reverse' => '7',
151+
'bold' => '1',
152+
'underscore' => '4',
153+
'reverse' => '7',
154154
];
155155

156156
/**
@@ -170,7 +170,7 @@ class Color
170170

171171
/**
172172
* @param string $method
173-
* @param array $args
173+
* @param array $args
174174
* @return string
175175
*/
176176
public static function __callStatic($method, array $args)
@@ -199,7 +199,7 @@ public static function apply(string $style, string $text): string
199199

200200
/**
201201
* render text
202-
* @param string $text
202+
* @param string $text
203203
* @param string|array $style
204204
* - string: 'green', 'blue'
205205
* - array: [Color::FG_GREEN, Color::BG_WHITE, Color::UNDERSCORE]
@@ -287,7 +287,7 @@ public static function wrapTag(string $string, string $tag): string
287287

288288
/**
289289
* @param string $text
290-
* @param bool $stripTag
290+
* @param bool $stripTag
291291
* @return string
292292
*/
293293
public static function clearColor(string $text, bool $stripTag = true): string

src/Console.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
class Console extends Cli
1616
{
1717
const LOG_LEVEL2TAG = [
18-
'info' => 'info',
19-
'warn' => 'warning',
18+
'info' => 'info',
19+
'warn' => 'warning',
2020
'warning' => 'warning',
21-
'debug' => 'cyan',
22-
'notice' => 'notice',
23-
'error' => 'error',
21+
'debug' => 'cyan',
22+
'notice' => 'notice',
23+
'error' => 'error',
2424
];
2525

2626
/**
2727
* print log to console
2828
* @param string $msg
29-
* @param array $data
29+
* @param array $data
3030
* @param string $type
31-
* @param array $opts
31+
* @param array $opts
3232
* [
3333
* '_category' => 'application',
3434
* 'process' => 'work',

src/Download.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
final class Download
1616
{
1717
const PROGRESS_TEXT = 'text';
18-
const PROGRESS_BAR = 'bar';
18+
const PROGRESS_BAR = 'bar';
1919

2020
/** @var int */
2121
private $fileSize;
@@ -92,12 +92,12 @@ public function start(): self
9292
}
9393

9494
/**
95-
* @param int $notifyCode stream notify code
96-
* @param int $severity severity code
95+
* @param int $notifyCode stream notify code
96+
* @param int $severity severity code
9797
* @param string $message Message text
98-
* @param int $messageCode Message code
99-
* @param int $transferredBytes Have been transferred bytes
100-
* @param int $maxBytes Target max length bytes
98+
* @param int $messageCode Message code
99+
* @param int $transferredBytes Have been transferred bytes
100+
* @param int $maxBytes Target max length bytes
101101
*/
102102
public function progressShow($notifyCode, $severity, $message, $messageCode, $transferredBytes, $maxBytes)
103103
{

0 commit comments

Comments
 (0)