From 8fcebbb7d4204141fda3ee8d6f0e6ba9c7087ded Mon Sep 17 00:00:00 2001 From: smiley Date: Thu, 27 Jul 2023 20:44:47 +0200 Subject: [PATCH] :shower: --- .scrutinizer.yml | 17 ----------------- src/Core/AccessToken.php | 24 +++++++++--------------- src/Core/OAuth2Provider.php | 3 +-- src/Core/OAuthProvider.php | 14 +++++++------- 4 files changed, 17 insertions(+), 41 deletions(-) delete mode 100644 .scrutinizer.yml diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 9e88d9a2..00000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,17 +0,0 @@ -build: - nodes: - analysis: - tests: - override: - - php-scrutinizer-run - environment: - php: 8.1.10 - -filter: - excluded_paths: - - config/* - - examples/* - - tests/* - - vendor/* - - .github/* - - .phan/* diff --git a/src/Core/AccessToken.php b/src/Core/AccessToken.php index 7dd57c8f..587d78ce 100644 --- a/src/Core/AccessToken.php +++ b/src/Core/AccessToken.php @@ -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; @@ -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); @@ -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(); @@ -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; diff --git a/src/Core/OAuth2Provider.php b/src/Core/OAuth2Provider.php index 07bcba14..c86a2475 100644 --- a/src/Core/OAuth2Provider.php +++ b/src/Core/OAuth2Provider.php @@ -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; diff --git a/src/Core/OAuthProvider.php b/src/Core/OAuthProvider.php index f576e36e..6c58cca7 100644 --- a/src/Core/OAuthProvider.php +++ b/src/Core/OAuthProvider.php @@ -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; @@ -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));