forked from jwilsson/spotify-web-api-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpotifyWebAPIAuthException.php
More file actions
32 lines (28 loc) · 876 Bytes
/
Copy pathSpotifyWebAPIAuthException.php
File metadata and controls
32 lines (28 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace SpotifyWebAPI;
class SpotifyWebAPIAuthException extends SpotifyWebAPIException
{
// extends from SpotifyWebApiException for backwards compatibility
const INVALID_CLIENT = 'Invalid client';
const INVALID_CLIENT_SECRET = 'Invalid client secret';
const INVALID_REFRESH_TOKEN = 'Invalid refresh token';
/**
* Returns if the exception was thrown because of invalid credentials.
* @return bool
*/
public function hasInvalidCredentials()
{
return in_array($this->getMessage(), [
self::INVALID_CLIENT,
self::INVALID_CLIENT_SECRET,
]);
}
/**
* Returns if the exception was thrown because of invalid refresh token.
* @return bool
*/
public function hasInvalidRefreshToken()
{
return $this->getMessage() === self::INVALID_REFRESH_TOKEN;
}
}