Closed helenye-stripe closed 5 months ago
Hey @gooroodev, can you review this please?
Thanks for bringing me on board, @admsev!
{mistakes: 0, typos: 1, security: 0, performance: 0, code_styling: 3, others: 0}
Summary of Changes:
_appInfo
property to ApiRequestor
class.ApiRequestor
to accept appInfo
._defaultHeaders
method to include appInfo
.app_info
to BaseStripeClient
configuration.app_info
in BaseStripeClient
.request
and requestStream
methods in BaseStripeClient
to pass appInfo
.app_info
in BaseStripeClient
.app_info
in BaseStripeClientTest
.Issues, Bugs, or Typos:
lib/BaseStripeClient.php:line 43
verion
should be version
.
General Review of Code Quality and Style:
Code Styling Improvements:
Indentation Consistency:
lib/ApiRequestor.php:line 131
$this->_requestRaw($method, $url, $params, $headers, $usage);
lib/ApiRequestor.php:line 153
$this->_requestRawStreaming($method, $url, $params, $headers, $usage, $readBodyChunkCallable);
Comment Formatting:
lib/ApiRequestor.php:line 220
// no break
Function Parameter Alignment:
lib/ApiRequestor.php:line 469
isset($rheaders['request-id'])
&& \is_string($rheaders['request-id'])
&& '' !== $rheaders['request-id']
Overall, the changes are well-implemented, with minor improvements needed for code styling and a typo correction. The new feature of adding optional appInfo
to the StripeClient
configuration is well-integrated and tested.
Yours, Gooroo.dev. I'd appreciate your feedback! React or reply.
This adds
$appInfo
as a valid key in$config
when initializing aStripeClient
. $appInfo expects the typeIt passes this in to
APIRequestor
as an init parameter with defaultnull
, and will be set in headers if not null.Tests verify that we fall back to global configuration if not passed into StripeClient, by verifying the
User-Agent
header.Changelog
StripeClient
can now accept$appInfo
as a$config
option, so AppInfo can be set per-client. If not passed in, will fall back on the global AppInfo set byStripe::setAppInfo()
.$appInfo
to be of typearray{name: string, version?: string, url?: string, partner_id?: string}