Update v1.0.6
This commit is contained in:
45
vendor/tymon/jwt-auth/src/Token.php
vendored
Normal file
45
vendor/tymon/jwt-auth/src/Token.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tymon\JWTAuth;
|
||||
|
||||
use Tymon\JWTAuth\Validators\TokenValidator;
|
||||
|
||||
class Token
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Create a new JSON Web Token
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
with(new TokenValidator)->check($value);
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token when casting to string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user