Skip to content

Commit

Permalink
Merge pull request #1220 from abraham/options
Browse files Browse the repository at this point in the history
Switch to using options argument
  • Loading branch information
abraham authored Feb 11, 2024
2 parents b56c62a + d281941 commit a862268
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 77 deletions.
7 changes: 3 additions & 4 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ class Request
protected $parameters;
protected $httpMethod;
protected $httpUrl;
protected $json;
public static $version = '1.0';

/**
* Constructor
*
* @param string $httpMethod
* @param string $httpUrl
* @param array|null $parameters
* @param ?array $parameters
*/
public function __construct(
string $httpMethod,
Expand Down Expand Up @@ -55,7 +54,7 @@ public static function fromConsumerAndToken(
string $httpMethod,
string $httpUrl,
array $parameters = [],
$json = false,
array $options = [],
) {
$defaults = [
'oauth_version' => Request::$version,
Expand All @@ -69,7 +68,7 @@ public static function fromConsumerAndToken(

// The json payload is not included in the signature on json requests,
// therefore it shouldn't be included in the parameters array.
if ($json) {
if ($options['jsonPayload'] ?? false) {
$parameters = $defaults;
} else {
$parameters = array_merge($defaults, $parameters);
Expand Down
Loading

0 comments on commit a862268

Please sign in to comment.