Skip to content

Commit

Permalink
Add return types
Browse files Browse the repository at this point in the history
  • Loading branch information
antalaron committed May 3, 2023
1 parent 4fb24b0 commit b18d956
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Disqus.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Antalaron\DisqusOAuth2\Exception\DisqusIdentityProviderException;
use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use League\OAuth2\Client\Token\AccessToken;
use Psr\Http\Message\ResponseInterface;

Expand All @@ -23,30 +24,30 @@ class Disqus extends AbstractProvider
{
public $domain = 'https://disqus.com';

public function getBaseAuthorizationUrl()
public function getBaseAuthorizationUrl(): string
{
return $this->domain.'/api/oauth/2.0/authorize/';
}

public function getBaseAccessTokenUrl(array $params)
public function getBaseAccessTokenUrl(array $params): string
{
return $this->domain.'/api/oauth/2.0/access_token/';
}

public function getResourceOwnerDetailsUrl(AccessToken $token)
public function getResourceOwnerDetailsUrl(AccessToken $token): string
{
return $this->domain.'/api/3.0/users/details.json?access_token='.$token
.'&api_key='.$this->clientId.'&api_secret='.$this->clientSecret;
}

protected function getDefaultScopes()
protected function getDefaultScopes(): array
{
return [
'read',
];
}

protected function checkResponse(ResponseInterface $response, $data)
protected function checkResponse(ResponseInterface $response, $data): void
{
if ($response->getStatusCode() >= 400) {
throw DisqusIdentityProviderException::clientException($response, $data);
Expand All @@ -55,7 +56,7 @@ protected function checkResponse(ResponseInterface $response, $data)
}
}

protected function createResourceOwner(array $response, AccessToken $token)
protected function createResourceOwner(array $response, AccessToken $token): ResourceOwnerInterface
{
return new DisqusResourceOwner($response);
}
Expand Down

0 comments on commit b18d956

Please sign in to comment.