Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
🚿
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jul 27, 2023
1 parent 8678d3b commit 8fcebbb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 41 deletions.
17 changes: 0 additions & 17 deletions .scrutinizer.yml

This file was deleted.

24 changes: 9 additions & 15 deletions src/Core/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ final class AccessToken extends SettingsContainerAbstract{
public const EOL_NEVER_EXPIRES = -9002;

/**
* defines a maximum expiry period (1 year)
* Defines a maximum expiry period (1 year)
*/
public const EXPIRY_MAX = (86400 * 365);

/**
* the access token secret (OAuth1)
* The access token secret (OAuth1)
*/
protected ?string $accessTokenSecret = null;

/**
* the oauth access token
* The oauth access token
*/
protected ?string $accessToken = null;

/**
* an optional refresh token (OAuth2)
* An optional refresh token (OAuth2)
*/
protected ?string $refreshToken = null;

/**
* the token expiration date/time
* The token expiration date/time
* @todo: change to DateInterval?
*/
protected ?int $expires = self::EOL_UNKNOWN;
Expand All @@ -82,14 +82,12 @@ final class AccessToken extends SettingsContainerAbstract{
protected array $scopes = [];

/**
* the provider who issued this token
* The provider who issued this token
*/
protected ?string $provider = null;

/**
* AccessToken constructor.
*
* @param iterable|null $properties
*/
public function __construct(iterable $properties = null){
parent::__construct($properties);
Expand All @@ -98,18 +96,14 @@ public function __construct(iterable $properties = null){
}

/**
* @param int|null $expires
*
* @return void
* Expiry setter
*/
protected function set_expires(int $expires = null):void{
$this->setExpiry($expires);
}

/**
* @param int|null $expires
*
* @return \chillerlan\OAuth\Core\AccessToken
* Sets the expiration for this token
*/
public function setExpiry(int $expires = null):AccessToken{
$now = time();
Expand All @@ -131,7 +125,7 @@ public function setExpiry(int $expires = null):AccessToken{
}

/**
* @return bool
* Checks whether this token is expired
*/
public function isExpired():bool{
return $this->expires !== $this::EOL_NEVER_EXPIRES && $this->expires !== $this::EOL_UNKNOWN && time() > $this->expires;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/OAuth2Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

namespace chillerlan\OAuth\Core;

use chillerlan\HTTP\Utils\MessageUtil;
use chillerlan\HTTP\Utils\QueryUtil;
use chillerlan\HTTP\Utils\{MessageUtil, QueryUtil};
use Psr\Http\Message\{RequestInterface, ResponseInterface, UriInterface};
use function array_merge;
use function base64_encode;
Expand Down
14 changes: 7 additions & 7 deletions src/Core/OAuthProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ abstract class OAuthProvider implements OAuthInterface{
* OAuthProvider constructor.
*/
public function __construct(
ClientInterface $http,
ClientInterface $http,
OAuthOptions|SettingsContainerInterface $options,
LoggerInterface $logger = null
LoggerInterface $logger = null
){
$this->http = $http;
$this->options = $options;
Expand Down Expand Up @@ -249,12 +249,12 @@ protected function createAccessToken():AccessToken{
* @inheritDoc
*/
public function request(
string $path,
array $params = null,
string $method = null,
string $path,
array $params = null,
string $method = null,
StreamInterface|array|string $body = null,
array $headers = null,
string $protocolVersion = null
array $headers = null,
string $protocolVersion = null
):ResponseInterface{
$request = $this->requestFactory->createRequest(($method ?? 'GET'), $this->getRequestURL($path, $params));

Expand Down

0 comments on commit 8fcebbb

Please sign in to comment.