Skip to content

Commit

Permalink
Add default values fro preview and raw_request parameters (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe authored May 24, 2023
1 parent ed76af5 commit acaaeb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/BaseStripeClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ public function request($method, $path, $params, $opts)
*
* @param 'delete'|'get'|'post' $method the HTTP method
* @param string $path the path of the request
* @param array $params the parameters of the request
* @param null|array $params the parameters of the request
* @param array $opts the special modifiers of the request
*
* @return \Stripe\ApiResponse
*/
public function rawRequest($method, $path, $params, $opts)
public function rawRequest($method, $path, $params = null, $opts = [])
{
if ('post' !== $method && null !== $params) {
throw new Exception\InvalidArgumentException('Error: rawRequest only supports $params on post requests. Please pass null and add your parameters to $path');
Expand Down
6 changes: 3 additions & 3 deletions lib/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ private function getDefaultOpts($opts)
return \array_merge(['api_mode' => 'preview'], $opts);
}

public function get($path, $opts)
public function get($path, $opts = [])
{
return $this->client->rawRequest('get', $path, null, $this->getDefaultOpts($opts));
}

public function post($path, $params, $opts)
public function post($path, $params, $opts = [])
{
return $this->client->rawRequest('post', $path, $params, $this->getDefaultOpts($opts));
}

public function delete($path, $opts)
public function delete($path, $opts = [])
{
return $this->client->rawRequest('delete', $path, null, $this->getDefaultOpts($opts));
}
Expand Down

0 comments on commit acaaeb4

Please sign in to comment.