Skip to content

Commit 3617424

Browse files
committed
update
1 parent 871f555 commit 3617424

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

libs/files/compress/PharCompressor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PharCompressor extends AbstractCompressor
2020
*/
2121
public function isSupported()
2222
{
23-
// TODO: Implement isSupported() method.
23+
return class_exists(\Phar::class, false);
2424
}
2525

2626
/**

libs/log/ProcessLogger.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Inhere\LibraryPlus\Log;
1010

1111
use Inhere\Library\Files\Directory;
12-
use Inhere\Library\Helpers\CliHelper;
12+
use Inhere\Library\Helpers\Cli;
1313
use Inhere\Library\Helpers\FormatHelper;
1414

1515
/**
@@ -178,7 +178,7 @@ public function log($msg, $level = self::INFO, array $data = [])
178178

179179
if ($this->fileHandle) {
180180
$this->count++;
181-
$this->cache[] = CliHelper::clearColor($logString);
181+
$this->cache[] = Cli::clearColor($logString);
182182

183183
if ($this->count >= $this->logThreshold || $this->fileIsChanged()) {
184184
$this->flush();
@@ -332,7 +332,7 @@ public function getLogFileDate()
332332
*/
333333
protected function stdout($text, $nl = true, $quit = false)
334334
{
335-
CliHelper::stdout($text, $nl, $quit);
335+
Cli::stdout($text, $nl, $quit);
336336
}
337337

338338
/**
@@ -343,7 +343,7 @@ protected function stdout($text, $nl = true, $quit = false)
343343
*/
344344
protected function stderr($text, $nl = true, $quit = -200)
345345
{
346-
CliHelper::stderr($text, $nl, $quit);
346+
Cli::stderr($text, $nl, $quit);
347347
}
348348

349349
/**

libs/task/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Inhere\LibraryPlus\Task;
1010

11-
use Inhere\Library\Helpers\CliHelper;
11+
use Inhere\Library\Helpers\Cli;
1212
use Inhere\Library\process\ProcessLogger;
1313
use Inhere\Library\queue\QueueInterface;
1414
use Inhere\Library\Traits\ConfigTrait;
@@ -92,7 +92,7 @@ public function log($msg, $level = ProcessLogger::INFO, array $data = [])
9292
*/
9393
protected function stdout($text, $nl = true, $quit = false)
9494
{
95-
CliHelper::stdout($text, $nl, $quit);
95+
Cli::stdout($text, $nl, $quit);
9696
}
9797

9898
/**
@@ -103,7 +103,7 @@ protected function stdout($text, $nl = true, $quit = false)
103103
*/
104104
protected function stderr($text, $nl = true, $quit = -200)
105105
{
106-
CliHelper::stderr($text, $nl, $quit);
106+
Cli::stderr($text, $nl, $quit);
107107
}
108108

109109
/**

libs/task/server/OptionAndConfigTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Inhere\LibraryPlus\Task\Server;
1010

11-
use Inhere\Library\Helpers\CliHelper;
11+
use Inhere\Library\Helpers\Cli;
1212

1313
/**
1414
* Class OptionAndConfigTrait
@@ -68,7 +68,7 @@ protected function parseCommandAndConfig()
6868
*/
6969
protected function parseCliOptions()
7070
{
71-
$result = CliHelper::parseOptArgs([
71+
$result = Cli::parseOptArgs([
7272
'd', 'daemon', 'w', 'watch', 'h', 'help', 'V', 'version', 'no-test', 'watch-status'
7373
]);
7474
$this->fullScript = implode(' ', $GLOBALS['argv']);

libs/task/worker/Manager.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Inhere\LibraryPlus\Task\Worker;
44

5-
use Inhere\Library\Helpers\CliHelper;
5+
use Inhere\Library\Helpers\Cli;
66
use Inhere\Library\Helpers\PhpHelper;
77
use Inhere\Library\process\ProcessLogger;
88
use Inhere\Library\queue\QueueFactory;
@@ -236,7 +236,7 @@ public function handleTask($data)
236236
*/
237237
protected function showVersion()
238238
{
239-
printf("Gearman worker manager script tool. Version %s\n", CliHelper::color(self::VERSION, 'green'));
239+
printf("Gearman worker manager script tool. Version %s\n", Cli::color(self::VERSION, 'green'));
240240

241241
$this->quit();
242242
}
@@ -248,16 +248,16 @@ protected function showVersion()
248248
*/
249249
protected function showHelp($msg = '', $code = 0)
250250
{
251-
$usage = CliHelper::color('USAGE:', 'brown');
252-
$commands = CliHelper::color('COMMANDS:', 'brown');
253-
$sOptions = CliHelper::color('SPECIAL OPTIONS:', 'brown');
254-
$pOptions = CliHelper::color('PUBLIC OPTIONS:', 'brown');
255-
$version = CliHelper::color(self::VERSION, 'green');
251+
$usage = Cli::color('USAGE:', 'brown');
252+
$commands = Cli::color('COMMANDS:', 'brown');
253+
$sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');
254+
$pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');
255+
$version = Cli::color(self::VERSION, 'green');
256256
$script = $this->getScript();
257257

258258
if ($msg) {
259259
$code = $code ?: self::CODE_UNKNOWN_ERROR;
260-
echo CliHelper::color('ERROR:', 'light_red') . "\n " . wordwrap($msg, 108, "\n ") . "\n\n";
260+
echo Cli::color('ERROR:', 'light_red') . "\n " . wordwrap($msg, 108, "\n ") . "\n\n";
261261
}
262262

263263
echo <<<EOF

libs/task/worker/OptionAndConfigTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Inhere\LibraryPlus\Task\Worker;
1010

11-
use Inhere\Library\Helpers\CliHelper;
11+
use Inhere\Library\Helpers\Cli;
1212

1313
/**
1414
* Class OptionAndConfigTrait
@@ -68,7 +68,7 @@ protected function parseCommandAndConfig()
6868
*/
6969
protected function parseCliOptions()
7070
{
71-
$result = CliHelper::parseOptArgs([
71+
$result = Cli::parseOptArgs([
7272
'd', 'daemon', 'w', 'watch', 'h', 'help', 'V', 'version', 'no-test', 'watch-status'
7373
]);
7474
$this->fullScript = implode(' ', $GLOBALS['argv']);

libs/task/worker/ProcessManageTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Inhere\LibraryPlus\Task\Worker;
1010

11-
use Inhere\Library\Helpers\CliHelper;
11+
use Inhere\Library\Helpers\Cli;
1212
use Inhere\Library\process\ProcessLogger;
1313
use Inhere\Library\process\ProcessUtil;
1414
use Inhere\Library\queue\QueueInterface;
@@ -215,7 +215,7 @@ protected function stopMaster($pid, $quit = true)
215215
ProcessUtil::killAndWait($pid, SIGTERM, 'manager');
216216

217217
// stop success
218-
$this->stdout(sprintf("\n%s\n"), CliHelper::color("The manager process stopped", CliHelper::FG_GREEN));
218+
$this->stdout(sprintf("\n%s\n"), Cli::color("The manager process stopped", Cli::FG_GREEN));
219219

220220
if ($quit) {
221221
$this->quit();

0 commit comments

Comments
 (0)