diff --git a/config/telescope-guzzle-watcher.php b/config/telescope-guzzle-watcher.php index befe11d..e374c7f 100644 --- a/config/telescope-guzzle-watcher.php +++ b/config/telescope-guzzle-watcher.php @@ -14,7 +14,7 @@ | */ - "except_request_headers" => [], + 'except_request_headers' => [], /* |-------------------------------------------------------------------------- @@ -27,7 +27,7 @@ | */ - "except_response_headers" => [], + 'except_response_headers' => [], /* |-------------------------------------------------------------------------- @@ -40,7 +40,7 @@ | */ - "enable_uri_tags" => true, + 'enable_uri_tags' => true, /* |-------------------------------------------------------------------------- @@ -52,5 +52,5 @@ | */ - "exclude_words_from_uri_tags" => [], + 'exclude_words_from_uri_tags' => [], ]; diff --git a/src/TelescopeGuzzleWatcherServiceProvider.php b/src/TelescopeGuzzleWatcherServiceProvider.php index 624d889..d3dda0d 100644 --- a/src/TelescopeGuzzleWatcherServiceProvider.php +++ b/src/TelescopeGuzzleWatcherServiceProvider.php @@ -4,7 +4,6 @@ use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; -use MuhammadHuzaifa\TelescopeGuzzleWatcher\Commands\TelescopeGuzzleWatcherCommand; class TelescopeGuzzleWatcherServiceProvider extends PackageServiceProvider { diff --git a/src/Watchers/TelescopeGuzzleWatcher.php b/src/Watchers/TelescopeGuzzleWatcher.php index 7070cc3..4364f16 100644 --- a/src/Watchers/TelescopeGuzzleWatcher.php +++ b/src/Watchers/TelescopeGuzzleWatcher.php @@ -14,7 +14,6 @@ class TelescopeGuzzleWatcher extends Watcher { - public function register($app) { $app->bind( @@ -48,19 +47,19 @@ private static function makeEntry(TransferStats $stats): IncomingEntry { $stats->getResponse()?->getBody()->rewind(); $stats->getRequest()?->getBody()->rewind(); - $requestBody = json_decode($stats->getRequest()?->getBody()->getContents() ?? "", true); + $requestBody = json_decode($stats->getRequest()?->getBody()->getContents() ?? '', true); $queryString = null; parse_str($stats->getRequest()?->getUri()->getQuery(), $queryString); - $payload = array_merge(["queryString" => $queryString ?? []], ["body" => $requestBody ?? []]); + $payload = array_merge(['queryString' => $queryString ?? []], ['body' => $requestBody ?? []]); $entry = IncomingEntry::make([ 'method' => $stats->getRequest()->getMethod(), - 'uri' => strtok($stats->getRequest()->getUri(), "?"), + 'uri' => strtok($stats->getRequest()->getUri(), '?'), 'headers' => Arr::except($stats->getRequest()->getHeaders(), config('telescope-guzzle-watcher.except_request_headers', [])), 'payload' => $payload, 'response_status' => $stats->getResponse()->getStatusCode(), 'response_headers' => Arr::except($stats->getResponse()->getHeaders(), config('telescope-guzzle-watcher.except_request_headers', [])), - 'response' => json_decode($stats->getResponse()->getBody()->getContents(), true) + 'response' => json_decode($stats->getResponse()->getBody()->getContents(), true), ]); if (Auth::check()) { @@ -78,15 +77,15 @@ private static function extractTagsFromUri(string $uri) { $parsedURI = parse_url($uri); $tags = [$parsedURI['host']]; - if (array_key_exists("path", $parsedURI)) { - $pathArr = array_filter(explode("/", $parsedURI['path'])); + if (array_key_exists('path', $parsedURI)) { + $pathArr = array_filter(explode('/', $parsedURI['path'])); $tags = array_merge($tags, $pathArr); } $exceptTags = config('telescope-guzzle-watcher.exclude_words_from_uri_tags'); if (count($exceptTags) > 0) { $tags = Arr::where($tags, function ($tag) use ($exceptTags) { - return !in_array($tag, $exceptTags); + return ! in_array($tag, $exceptTags); }); } diff --git a/tests/TestCase.php b/tests/TestCase.php index ed1f51f..fe6bfc4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,8 +3,8 @@ namespace MuhammadHuzaifa\TelescopeGuzzleWatcher\Tests; use Illuminate\Database\Eloquent\Factories\Factory; -use Orchestra\Testbench\TestCase as Orchestra; use MuhammadHuzaifa\TelescopeGuzzleWatcher\TelescopeGuzzleWatcherServiceProvider; +use Orchestra\Testbench\TestCase as Orchestra; class TestCase extends Orchestra {