2424 */
2525class Deezer extends OAuth2Provider implements CSRFToken{
2626
27- public const SCOPE_BASIC = 'basic_access ' ;
28- public const SCOPE_EMAIL = 'email ' ;
29- public const SCOPE_OFFLINE_ACCESS = 'offline_access ' ;
30- public const SCOPE_MANAGE_LIBRARY = 'manage_library ' ;
31- public const SCOPE_MANAGE_COMMUNITY = 'manage_community ' ;
32- public const SCOPE_DELETE_LIBRARY = 'delete_library ' ;
33- public const SCOPE_LISTENING_HISTORY = 'listening_history ' ;
34-
35- protected string $ authURL = 'https://connect.deezer.com/oauth/auth.php ' ;
36- protected string $ accessTokenURL = 'https://connect.deezer.com/oauth/access_token.php ' ;
37- protected string $ apiURL = 'https://api.deezer.com ' ;
38- protected ?string $ userRevokeURL = 'https://www.deezer.com/account/apps ' ;
39- protected ?string $ apiDocs = 'https://developers.deezer.com/api ' ;
40- protected ?string $ applicationURL = 'http://developers.deezer.com/myapps ' ;
41- protected int $ authMethod = self ::AUTH_METHOD_QUERY ;
42-
43- protected array $ defaultScopes = [
27+ public const SCOPE_BASIC = 'basic_access ' ;
28+ public const SCOPE_EMAIL = 'email ' ;
29+ public const SCOPE_OFFLINE_ACCESS = 'offline_access ' ;
30+ public const SCOPE_MANAGE_LIBRARY = 'manage_library ' ;
31+ public const SCOPE_MANAGE_COMMUNITY = 'manage_community ' ;
32+ public const SCOPE_DELETE_LIBRARY = 'delete_library ' ;
33+ public const SCOPE_LISTENING_HISTORY = 'listening_history ' ;
34+
35+ protected array $ defaultScopes = [
4436 self ::SCOPE_BASIC ,
4537 self ::SCOPE_EMAIL ,
4638 self ::SCOPE_OFFLINE_ACCESS ,
4739 self ::SCOPE_MANAGE_LIBRARY ,
4840 self ::SCOPE_LISTENING_HISTORY ,
4941 ];
5042
43+ protected string $ authURL = 'https://connect.deezer.com/oauth/auth.php ' ;
44+ protected string $ accessTokenURL = 'https://connect.deezer.com/oauth/access_token.php ' ;
45+ protected string $ apiURL = 'https://api.deezer.com ' ;
46+ protected string |null $ userRevokeURL = 'https://www.deezer.com/account/apps ' ;
47+ protected string |null $ apiDocs = 'https://developers.deezer.com/api ' ;
48+ protected string |null $ applicationURL = 'http://developers.deezer.com/myapps ' ;
49+ protected int $ authMethod = self ::AUTH_METHOD_QUERY ;
50+
5151 /**
5252 * @inheritDoc
5353 */
54- public function getAuthURL (array $ params = null , array $ scopes = null ):UriInterface {
54+ public function getAuthURL (array | null $ params = null , array | null $ scopes = null ):UriInterface {
5555 $ params ??= [];
5656
5757 if (isset ($ params ['client_secret ' ])){
@@ -72,7 +72,7 @@ public function getAuthURL(array $params = null, array $scopes = null):UriInterf
7272 /**
7373 * @inheritDoc
7474 */
75- public function getAccessToken (string $ code , string $ state = null ):AccessToken {
75+ public function getAccessToken (string $ code , string | null $ state = null ):AccessToken {
7676 $ this ->checkState ($ state );
7777
7878 $ body = [
@@ -112,7 +112,7 @@ protected function parseTokenResponse(ResponseInterface $response):AccessToken{
112112 $ token = $ this ->createAccessToken ();
113113
114114 $ token ->accessToken = $ data ['access_token ' ];
115- $ token ->expires = ($ data ['expires ' ] ?? $ data ['expires_in ' ] ?? AccessToken::EOL_NEVER_EXPIRES );
115+ $ token ->expires = (int )( $ data ['expires ' ] ?? $ data ['expires_in ' ] ?? AccessToken::EOL_NEVER_EXPIRES );
116116 $ token ->refreshToken = ($ data ['refresh_token ' ] ?? null );
117117
118118 unset($ data ['expires ' ], $ data ['expires_in ' ], $ data ['refresh_token ' ], $ data ['access_token ' ]);
0 commit comments