Skip to content

Commit 4d4a9da

Browse files
committed
refactor(debug): simplify debug info output in Client and Response classes
- Comment out detailed debug info fields in __debugInfo methods to reduce verbosity - Ensure getHttpClient is called in Client::__debugInfo for side effects or initialization - Keep summary information in Response::__debugInfo while hiding handlerStats and decodedBody details - Improve clarity and maintainability by limiting debug data exposed during debugging Signed-off-by: guanguans <ityaozm@gmail.com>
1 parent 746db47 commit 4d4a9da

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/Foundation/Client.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ public function __construct(?Authenticator $authenticator = null)
3636

3737
public function __debugInfo(): array
3838
{
39+
$this->getHttpClient();
40+
3941
return $this->mergeDebugInfo([
40-
'httpClient' => $this->getHttpClient(),
41-
'httpClientResolver' => $this->getHttpClientResolver(),
42-
'handlerStack' => $this->getHandlerStack(),
43-
'handlerStackResolver' => $this->getHandlerStackResolver(),
44-
'httpOptions' => $this->getHttpOptions(),
42+
// 'httpClient' => $this->getHttpClient(),
43+
// 'httpClientResolver' => $this->getHttpClientResolver(),
44+
// 'handlerStack' => $this->getHandlerStack(),
45+
// 'handlerStackResolver' => $this->getHandlerStackResolver(),
46+
// 'httpOptions' => $this->getHttpOptions(),
4547
]);
4648
}
4749

src/Foundation/Response.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ class Response extends \GuzzleHttp\Psr7\Response implements \ArrayAccess, \Strin
6363
*/
6464
public function __debugInfo(): array
6565
{
66+
$this->json();
67+
6668
return $this->mergeDebugInfo([
67-
'handlerStats' => $this->handlerStats(),
69+
// 'handlerStats' => $this->handlerStats(),
6870
'requestSummary' => $this->request instanceof RequestInterface ? Message::toString($this->request) : null,
6971
'responseSummary' => Message::toString($this),
70-
'decodedBody' => $this->json(),
72+
// 'decodedBody' => $this->json(),
7173
]);
7274
}
7375

src/ZohoCliq/Authenticator.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ private function authMiddleware(): callable
134134
*/
135135
private function baseUriMiddleware(string $baseUri): callable
136136
{
137-
$parsedBaseUri = parse_url($baseUri);
138-
139137
return Middleware::mapRequest(
140-
static fn (RequestInterface $request): RequestInterface => $request->withUri(
141-
$request->getUri()->withScheme($parsedBaseUri['scheme'])->withHost($parsedBaseUri['host']),
142-
$request->hasHeader('Host')
143-
),
138+
static function (RequestInterface $request) use ($baseUri): RequestInterface {
139+
$parsedBaseUri = parse_url($baseUri);
140+
141+
return $request->withUri(
142+
$request->getUri()->withScheme($parsedBaseUri['scheme'])->withHost($parsedBaseUri['host']),
143+
$request->hasHeader('Host')
144+
);
145+
},
144146
);
145147
}
146148

0 commit comments

Comments
 (0)