1 | <?php |
||
15 | class Spotify extends AbstractProvider |
||
16 | { |
||
17 | use BearerAuthorizationTrait; |
||
18 | |||
19 | public const BASE_SPOTIFY_URL = 'https://accounts.spotify.com/'; |
||
20 | public const RESPONSE_TYPE = 'code'; |
||
21 | |||
22 | // Available scopes. |
||
23 | |||
24 | // Images |
||
25 | public const SCOPE_UGC_IMAGE_UPLOAD = 'ugc-image-upload'; |
||
26 | |||
27 | // Spotify Connect |
||
28 | public const SCOPE_USER_MODIFY_PLAYBACK_STATE = 'user-modify-playback-state'; |
||
29 | public const SCOPE_USER_READ_PLAYBACK_STATE = 'user-read-playback-state'; |
||
30 | public const SCOPE_USER_READ_CURRENTLY_PLAYING = 'user-read-currently-playing'; |
||
31 | |||
32 | // Listening History |
||
33 | public const SCOPE_USER_TOP_READ = 'user-top-read'; |
||
34 | public const SCOPE_USER_READ_RECENTLY_PLAYED = 'user-read-recently-played'; |
||
35 | |||
36 | // Library |
||
37 | public const SCOPE_USER_LIBRARY_MODIFY = 'user-library-modify'; |
||
38 | public const SCOPE_USER_LIBRARY_READ = 'user-library-read'; |
||
39 | |||
40 | // Follow |
||
41 | public const SCOPE_USER_FOLLOW_MODIFY = 'user-follow-modify'; |
||
42 | public const SCOPE_USER_FOLLOW_READ = 'user-follow-read'; |
||
43 | |||
44 | // Playlist |
||
45 | public const SCOPE_PLAYLIST_READ_PRIVATE = 'playlist-read-private'; |
||
46 | public const SCOPE_PLAYLIST_MODIFY_PUBLIC = 'playlist-modify-public'; |
||
47 | public const SCOPE_PLAYLIST_MODIFY_PRIVATE = 'playlist-modify-private'; |
||
48 | public const SCOPE_PLAYLIST_READ_COLLABORATIVE = 'playlist-read-collaborative'; |
||
49 | |||
50 | // User |
||
51 | public const SCOPE_USER_READ_PRIVATE = 'user-read-private'; |
||
52 | public const SCOPE_USER_READ_EMAIL = 'user-read-email'; |
||
53 | |||
54 | // Playback |
||
55 | public const SCOPE_APP_REMOTE_CONTROL = 'app-remote-control'; |
||
56 | public const SCOPE_STREAMING = 'streaming'; |
||
57 | |||
58 | public function __construct(array $options = [], array $collaborators = []) |
||
66 | |||
67 | 8 | /** |
|
68 | 8 | * Returns the base URL for authorizing a client. |
|
69 | */ |
||
70 | public function getBaseAuthorizationUrl(): string |
||
74 | |||
75 | 2 | /** |
|
76 | * Returns the base URL for requesting an access token. |
||
77 | */ |
||
78 | public function getBaseAccessTokenUrl(array $params): string |
||
82 | |||
83 | 2 | /** |
|
84 | * Returns the URL for requesting the resource owner's details. |
||
85 | */ |
||
86 | public function getResourceOwnerDetailsUrl(AccessToken $token): string |
||
90 | |||
91 | 1 | /** |
|
92 | * Returns the default scopes used by this provider. |
||
93 | * |
||
94 | * This should only be the scopes that are required to request the details |
||
95 | * of the resource owner, rather than all the available scopes. |
||
96 | */ |
||
97 | protected function getDefaultScopes(): array |
||
101 | |||
102 | 2 | /** |
|
103 | * Checks a provider response for errors. |
||
104 | * |
||
105 | * @param array|string $data Parsed response data |
||
106 | * |
||
107 | * @throws IdentityProviderException |
||
108 | */ |
||
109 | protected function checkResponse(ResponseInterface $response, $data): void |
||
123 | 2 | ||
124 | /** |
||
125 | 1 | * Generates a resource owner object from a successful resource owner |
|
126 | * details request. |
||
127 | */ |
||
128 | protected function createResourceOwner(array $response, AccessToken $token): ResourceOwnerInterface |
||
132 | } |
||
133 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: