Skip to content

Commit 5636344

Browse files
committed
update lite sytle and format codes
1 parent 2370497 commit 5636344

15 files changed

+205
-154
lines changed

src/Base/AbstractApplication.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ protected function runtimeCheck()
113113
if (!in_array(PHP_SAPI, ['cli', 'cli-server'], true)) {
114114
header('HTTP/1.1 403 Forbidden');
115115
exit(" 403 Forbidden \n\n"
116-
. " current environment is CLI. \n"
117-
. " :( Sorry! Run this script is only allowed in the terminal environment!\n,You are not allowed to access this file.\n");
116+
. " current environment is CLI. \n"
117+
. " :( Sorry! Run this script is only allowed in the terminal environment!\n,You are not allowed to access this file.\n");
118118
}
119119
}
120120

@@ -161,7 +161,7 @@ public function run($exit = true)
161161
self::fire(self::ON_AFTER_RUN, [$this]);
162162

163163
if ($exit) {
164-
$this->stop((int) $returnCode);
164+
$this->stop((int)$returnCode);
165165
}
166166
}
167167

@@ -179,7 +179,7 @@ public function stop($code = 0)
179179
// call 'onAppStop' service, if it is registered.
180180
self::fire(self::ON_STOP_RUN, [$this]);
181181

182-
exit((int) $code);
182+
exit((int)$code);
183183
}
184184

185185

src/Base/AbstractCommand.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public function __construct(Input $input, Output $output, InputDefinition $defin
9090
}
9191

9292
protected function init()
93-
{}
93+
{
94+
}
9495

9596
/**
9697
* configure input definition
@@ -122,7 +123,7 @@ public function run()
122123
// load input definition configure
123124
$this->configure();
124125

125-
if ($this->input->sameOpt(['h','help'])) {
126+
if ($this->input->sameOpt(['h', 'help'])) {
126127
return $this->showHelp();
127128
}
128129

@@ -309,7 +310,7 @@ protected function replaceAnnotationVars($str)
309310

310311
/**
311312
* show help by parse method annotation
312-
* @param string $method
313+
* @param string $method
313314
* @param null|string $action
314315
* @return int
315316
*/
@@ -343,12 +344,12 @@ protected function showHelpByMethodAnnotation($method, $action = null)
343344

344345
// need multi align
345346
// if (self::$annotationTags[$tag]) {
346-
// $lines = array_map(function ($line) {
347-
// // return trim($line);
348-
// return $line;
349-
// }, explode("\n", $msg));
347+
// $lines = array_map(function ($line) {
348+
// // return trim($line);
349+
// return $line;
350+
// }, explode("\n", $msg));
350351

351-
// $msg = implode("\n", array_filter($lines, 'trim'));
352+
// $msg = implode("\n", array_filter($lines, 'trim'));
352353
// }
353354

354355
$tag = ucfirst($tag);

src/Base/ApplicationInterface.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface ApplicationInterface
2525
const ON_NOT_FOUND = 'notFound';
2626

2727
public function run($exit = true);
28+
2829
public function stop($code = 0);
2930

3031
public function controller(string $name, string $controller = null);

src/Command.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ abstract class Command extends AbstractCommand
3232
*/
3333
// protected function configure()
3434
// {
35-
// $this
36-
// ->createDefinition()
37-
// ->addArgument('test')
38-
// ->addOption('test');
35+
// $this
36+
// ->createDefinition()
37+
// ->addArgument('test')
38+
// ->addOption('test');
3939
// }
4040

4141
/**

src/IO/Input.php

+5
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public function getSameArg(array $names, $default = null)
257257
{
258258
return $this->sameArg($names, $default);
259259
}
260+
260261
public function sameArg(array $names, $default = null)
261262
{
262263
foreach ($names as $name) {
@@ -325,6 +326,7 @@ public function getBoolOpt(string $name, $default = false): bool
325326
{
326327
return (bool)$this->getOpt($name, $default);
327328
}
329+
328330
public function boolOpt(string $name, $default = false): bool
329331
{
330332
return (bool)$this->getOpt($name, $default);
@@ -356,6 +358,7 @@ public function getSameOpt(array $names, $default = null)
356358
{
357359
return $this->sameOpt($names, $default);
358360
}
361+
359362
public function sameOpt(array $names, $default = null)
360363
{
361364
foreach ($names as $name) {
@@ -379,6 +382,7 @@ public function sOpt($name, $default = null)
379382
{
380383
return $this->sOpts[$name] ?? $default;
381384
}
385+
382386
public function getShortOpt($name, $default = null)
383387
{
384388
return $this->sOpts[$name] ?? $default;
@@ -444,6 +448,7 @@ public function lOpt($name, $default = null)
444448
{
445449
return $this->lOpts[$name] ?? $default;
446450
}
451+
447452
public function getLongOpt($name, $default = null)
448453
{
449454
return $this->lOpts[$name] ?? $default;

src/IO/InputDefinition.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public function getSynopsis($short = false)
406406
$elements[] = sprintf('[%s--%s%s]', $shortcut, $name, $value);
407407

408408
$key = "{$shortcut}--{$name}";
409-
$opts[$key] = ($option['required'] ? '<red>*</red>' : '') .$option['description'];
409+
$opts[$key] = ($option['required'] ? '<red>*</red>' : '') . $option['description'];
410410
}
411411
}
412412

src/IO/InputInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface InputInterface
1919
const ARG_OPTIONAL = 2;
2020
const ARG_IS_ARRAY = 4;
2121

22-
const OPT_BOOLEAN = 1;
22+
const OPT_BOOLEAN = 1;
2323
const OPT_REQUIRED = 2;
2424
const OPT_OPTIONAL = 4;
2525
const OPT_IS_ARRAY = 8;

src/LiteApplication.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class LiteApplication
3131
*/
3232
private $opts = [];
3333

34-
/** @var string */
34+
/** @var string */
3535
private $script = '';
3636

37-
/** @var string */
37+
/** @var string */
3838
private $command = '';
3939

4040
/**

src/Style/Color.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ final class Color
2424
const BG_BASE = 40;
2525

2626
// color
27-
const BLACK = 'black';
28-
const RED = 'red';
29-
const GREEN = 'green';
30-
const YELLOW = 'yellow'; // BROWN
31-
const BLUE = 'blue';
32-
const MAGENTA = 'magenta';
33-
const CYAN = 'cyan';
34-
const WHITE = 'white';
35-
const NORMAL = 'normal';
27+
const BLACK = 'black';
28+
const RED = 'red';
29+
const GREEN = 'green';
30+
const YELLOW = 'yellow'; // BROWN
31+
const BLUE = 'blue';
32+
const MAGENTA = 'magenta';
33+
const CYAN = 'cyan';
34+
const WHITE = 'white';
35+
const NORMAL = 'normal';
3636

3737
// color option
38-
const BOLD = 'bold'; // 加粗
39-
const FUZZY = 'fuzzy'; // 模糊(不是所有的终端仿真器都支持)
40-
const ITALIC = 'italic'; // 斜体(不是所有的终端仿真器都支持)
41-
const UNDERSCORE = 'underscore'; // 下划线
42-
const BLINK = 'blink'; // 闪烁
43-
const REVERSE = 'reverse'; // 颠倒的 交换背景色与前景色
44-
const CONCEALED = 'concealed'; // 隐匿的
38+
const BOLD = 'bold'; // 加粗
39+
const FUZZY = 'fuzzy'; // 模糊(不是所有的终端仿真器都支持)
40+
const ITALIC = 'italic'; // 斜体(不是所有的终端仿真器都支持)
41+
const UNDERSCORE = 'underscore'; // 下划线
42+
const BLINK = 'blink'; // 闪烁
43+
const REVERSE = 'reverse'; // 颠倒的 交换背景色与前景色
44+
const CONCEALED = 'concealed'; // 隐匿的
4545

4646
/**
4747
* Known color list
@@ -90,7 +90,7 @@ final class Color
9090
/**
9191
* @param string $fg
9292
* @param string $bg
93-
* @param array $options
93+
* @param array $options
9494
* @return Color
9595
*/
9696
public static function make($fg = '', $bg = '', array $options = [])

0 commit comments

Comments
 (0)