Skip to content

Commit

Permalink
feat(Authenticators): Add reversed option to OptionsAuthenticator
Browse files Browse the repository at this point in the history
- Add `reversed` property to OptionsAuthenticator class
- Initialize `reversed` property in constructor
- Update `applyToOptions` method to merge options accordingly based on the `reversed` property
  • Loading branch information
guanguans committed Jan 13, 2025
1 parent e5753b1 commit ae2085d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Foundation/Authenticators/OptionsAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
class OptionsAuthenticator extends NullAuthenticator
{
private array $options;
private bool $reversed;

public function __construct(array $options)
public function __construct(array $options, bool $reversed = false)
{
$this->options = $options;
$this->reversed = $reversed;
}

public function applyToOptions(array $options): array
{
return Utils::mergeHttpOptions($options, $this->options);
return $this->reversed
? Utils::mergeHttpOptions($this->options, $options)
: Utils::mergeHttpOptions($options, $this->options);
}
}

0 comments on commit ae2085d

Please sign in to comment.