Skip to content

Commit

Permalink
Switch to using options argument
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham committed Feb 11, 2024
1 parent b56c62a commit d281941
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
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

0 comments on commit d281941

Please sign in to comment.