| 1 | <?php |
||
| 9 | class Token |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private $claims; |
||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $tokenString; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Constructor |
||
| 22 | * @param string $tokenString |
||
| 23 | * @param array $claims |
||
| 24 | */ |
||
| 25 | 26 | public function __construct($tokenString, $claims = []) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Get a specific claim |
||
| 33 | * @param string $claim Name of claim |
||
| 34 | * @return mixed Null on not found |
||
| 35 | */ |
||
| 36 | 9 | public function getClaim($claim) |
|
| 43 | |||
| 44 | |||
| 45 | /** |
||
| 46 | * Check for a specific claim |
||
| 47 | * @param string $claim Name of claim |
||
| 48 | * @return mixed Null on not found |
||
| 49 | */ |
||
| 50 | 4 | public function hasClaim($claim) |
|
| 54 | |||
| 55 | /** |
||
| 56 | * Get all claims |
||
| 57 | * |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | 1 | public function getClaims() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * Get token string |
||
| 67 | * @return string String variant of token |
||
| 68 | */ |
||
| 69 | 1 | public function getTokenString() |
|
| 73 | |||
| 74 | /** |
||
| 75 | * Convert object to string |
||
| 76 | * @return string String variant of token |
||
| 77 | */ |
||
| 78 | 18 | public function __toString() |
|
| 82 | } |
||
| 83 |