|
6 | 6 | * @author Smiley <[email protected]>
|
7 | 7 | * @copyright 2017 Smiley
|
8 | 8 | * @license MIT
|
| 9 | + * |
| 10 | + * @filesource |
9 | 11 | */
|
10 | 12 | declare(strict_types=1);
|
11 | 13 |
|
|
18 | 20 | /**
|
19 | 21 | * Access token implementation for any OAuth version.
|
20 | 22 | *
|
21 |
| - * @see https://datatracker.ietf.org/doc/html/rfc5849#section-2.3 |
22 |
| - * @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.4 |
23 |
| - * |
24 |
| - * // Oauth1 |
25 |
| - * @property string|null $accessTokenSecret |
26 |
| - * |
27 |
| - * // Oauth2 |
28 |
| - * @property array $scopes |
29 |
| - * @property string|null $refreshToken |
30 |
| - * |
31 |
| - * // common |
32 |
| - * @property string|null $accessToken |
33 |
| - * @property DateTime|DateInterval|int|null $expires |
34 |
| - * @property array $extraParams |
35 |
| - * @property string $provider |
| 23 | + * @link https://datatracker.ietf.org/doc/html/rfc5849#section-2.3 |
| 24 | + * @link https://datatracker.ietf.org/doc/html/rfc6749#section-1.4 |
36 | 25 | */
|
37 | 26 | final class AccessToken extends SettingsContainerAbstract{
|
38 | 27 |
|
39 | 28 | /**
|
40 | 29 | * Denotes an unknown end of lifetime, such a token should be considered as expired.
|
| 30 | + * |
| 31 | + * @var int |
41 | 32 | */
|
42 | 33 | public const EXPIRY_UNKNOWN = -9001;
|
43 | 34 |
|
44 | 35 | /**
|
45 | 36 | * Denotes a token which never expires
|
| 37 | + * |
| 38 | + * @var int |
46 | 39 | */
|
47 | 40 | public const NEVER_EXPIRES = -9002;
|
48 | 41 |
|
49 | 42 | /**
|
50 | 43 | * Defines a maximum expiry period (1 year)
|
| 44 | + * |
| 45 | + * @var int |
51 | 46 | */
|
52 | 47 | public const EXPIRY_MAX = (86400 * 365);
|
53 | 48 |
|
54 | 49 | /**
|
55 |
| - * The access token secret (OAuth1) |
| 50 | + * (magic) The oauth access token |
56 | 51 | */
|
57 |
| - protected string|null $accessTokenSecret = null; |
| 52 | + protected string|null $accessToken = null; |
58 | 53 |
|
59 | 54 | /**
|
60 |
| - * The oauth access token |
| 55 | + * (magic) The access token secret (OAuth1) |
61 | 56 | */
|
62 |
| - protected string|null $accessToken = null; |
| 57 | + protected string|null $accessTokenSecret = null; |
63 | 58 |
|
64 | 59 | /**
|
65 |
| - * An optional refresh token (OAuth2) |
| 60 | + * (magic) An optional refresh token (OAuth2) |
66 | 61 | */
|
67 | 62 | protected string|null $refreshToken = null;
|
68 | 63 |
|
69 | 64 | /**
|
70 |
| - * The token expiration date/time |
| 65 | + * (magic) The token expiration time |
| 66 | + * |
| 67 | + * The getter accepts: `DateTime|DateInterval|int|null` |
71 | 68 | */
|
72 | 69 | protected int $expires = self::EXPIRY_UNKNOWN;
|
73 | 70 |
|
74 | 71 | /**
|
75 |
| - * Additional token parameters supplied by the provider |
| 72 | + * (magic) The scopes that are attached to this token |
76 | 73 | */
|
77 |
| - protected array $extraParams = []; |
| 74 | + protected array $scopes = []; |
78 | 75 |
|
79 | 76 | /**
|
80 |
| - * The scopes that are attached to this token (OAuth2) |
| 77 | + * (magic) Additional token parameters supplied by the provider |
81 | 78 | */
|
82 |
| - protected array $scopes = []; |
| 79 | + protected array $extraParams = []; |
83 | 80 |
|
84 | 81 | /**
|
85 |
| - * The provider who issued this token |
| 82 | + * (magic) The provider that issued the token |
86 | 83 | */
|
87 | 84 | protected string|null $provider = null;
|
88 | 85 |
|
|
0 commit comments