Skip to content

Commit

Permalink
升级guanguans/soar-php至3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wilbur-yu committed Feb 17, 2023
1 parent 5c56f82 commit 53d9659
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": ">=7.0",
"swoole/ide-helper": "^5.0",
"symfony/var-dumper": "^5.1"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/Aspect/ResponseAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function parallel(array $eventSqlList): array
try {
foreach ($eventSqlList as $sql) {
$parallel->add(function () use ($sql) {
$soar = $this->service->score($sql);
$soar = $this->service->jsonScores($sql);

return $this->formatting($soar);
});
Expand Down
4 changes: 2 additions & 2 deletions src/Exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Wilbur\HyperfSoar;

use Guanguans\SoarPHP\Exceptions\RuntimeException;
use Guanguans\SoarPHP\Support\OsHelper;
use Guanguans\SoarPHP\Support\OS;
use Swoole\Coroutine\System;

trait Exec
Expand All @@ -30,7 +30,7 @@ trait Exec
*/
public function exec(string $command): string
{
OsHelper::isWindows() && $command = 'powershell '.$command;
OS::isWindows() && $command = 'powershell '.$command;
$result = System::exec($command);

if ($result['code'] !== 0) {
Expand Down
16 changes: 2 additions & 14 deletions src/SoarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

use Guanguans\SoarPHP\Soar;

use Guanguans\SoarPHP\Support\OsHelper;
use Guanguans\SoarPHP\Support\OS;

use function config;

class SoarService extends Soar
{
use Exec;
// use Exec;

public function __construct(array $config = null)
{
Expand All @@ -33,16 +33,4 @@ public function __construct(array $config = null)
unset($config['enabled'], $config['cut_classes'], $config['-soar-path']);
parent::__construct($config, $soarPath);
}

protected function getDefaultSoarPath(): string
{
if (OsHelper::isWindows()) {
return __DIR__.'/../vendor/guanguans/soar-php/bin/soar.windows-amd64';
}
if (OsHelper::isMacOS()) {
return __DIR__.'/../vendor/guanguans/soar-php/bin/soar.darwin-amd64';
}

return __DIR__.'/../vendor/guanguans/soar-php/bin/soar.linux-amd64';
}
}

0 comments on commit 53d9659

Please sign in to comment.