Skip to content

Commit 17a8035

Browse files
committed
配置项中soar-path可为空
1 parent c1f7d21 commit 17a8035

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

src/Aspect/ResponseAspect.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Hyperf\Di\Aop\ProceedingJoinPoint;
2323
use Hyperf\Engine\Channel;
2424
use Hyperf\HttpMessage\Stream\SwooleStream;
25-
use Hyperf\Utils\Arr;
2625
use Hyperf\Utils\Context;
2726
use Hyperf\Utils\Str;
2827
use Throwable;
@@ -129,21 +128,20 @@ protected function getScore(?string $severity = null): ?int
129128
*/
130129
protected function formatting(string $json): array
131130
{
132-
$results = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
133-
return $results;
134-
$results = Arr::flatten($results, 1);
135-
136-
$items = [];
137-
foreach ($results as $result) {
138-
$score = $this->getScore($result['Severity']);
139-
if ($score) {
140-
$result['Score'] = $score;
141-
}
142-
$items[] = $result;
143-
}
144-
145-
unset($results);
146-
147-
return $items;
131+
return json_decode($json, true, 512, JSON_THROW_ON_ERROR);
132+
// $results = Arr::flatten($results, 1);
133+
//
134+
// $items = [];
135+
// foreach ($results as $result) {
136+
// $score = $this->getScore($result['Severity']);
137+
// if ($score) {
138+
// $result['Score'] = $score;
139+
// }
140+
// $items[] = $result;
141+
// }
142+
//
143+
// unset($results);
144+
//
145+
// return $items;
148146
}
149147
}

src/Exec.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
namespace Wilbur\HyperfSoar;
1717

18-
use Guanguans\SoarPHP\Exceptions\InvalidArgumentException;
1918
use Guanguans\SoarPHP\Exceptions\RuntimeException;
2019
use Guanguans\SoarPHP\Support\OsHelper;
2120
use Swoole\Coroutine\System;

src/Listener/QueryExecListener.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Hyperf\Utils\Context;
2424
use Hyperf\Utils\Str;
2525

26-
use function class_basename;
2726

2827
#[Listener]
2928
class QueryExecListener implements ListenerInterface
@@ -48,8 +47,8 @@ public function process(object $event): void
4847
if ($event instanceof QueryExecuted && $this->soarIsEnabled) {
4948
$sql = str_replace('`', '', $event->sql);
5049
if (!Arr::isAssoc($event->bindings)) {
51-
foreach ($event->bindings as $key => $value) {
52-
$sql = Str::replaceFirst('?', "'{$value}'", $sql);
50+
foreach ($event->bindings as $value) {
51+
$sql = Str::replaceFirst('?', "'$value'", $sql);
5352
}
5453
}
5554
$eventSqlList = (array)Context::get(self::SQL_RECORD_KEY);

0 commit comments

Comments
 (0)