Update v1.0.6.5
This commit is contained in:
31
vendor/tymon/jwt-auth/src/Claims/Claim.php
vendored
31
vendor/tymon/jwt-auth/src/Claims/Claim.php
vendored
@@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of jwt-auth.
|
||||
*
|
||||
* (c) Sean Tymon <tymon148@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tymon\JWTAuth\Claims;
|
||||
|
||||
use Tymon\JWTAuth\Exceptions\InvalidClaimException;
|
||||
@@ -7,14 +16,14 @@ use Tymon\JWTAuth\Exceptions\InvalidClaimException;
|
||||
abstract class Claim implements ClaimInterface
|
||||
{
|
||||
/**
|
||||
* The claim name
|
||||
* The claim name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* The claim value
|
||||
* The claim value.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
@@ -29,7 +38,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the claim value, and call a validate method if available
|
||||
* Set the claim value, and call a validate method if available.
|
||||
*
|
||||
* @param $value
|
||||
* @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException
|
||||
@@ -38,7 +47,7 @@ abstract class Claim implements ClaimInterface
|
||||
public function setValue($value)
|
||||
{
|
||||
if (! $this->validate($value)) {
|
||||
throw new InvalidClaimException('Invalid value provided for claim "' . $this->getName() . '": ' . $value);
|
||||
throw new InvalidClaimException('Invalid value provided for claim "'.$this->getName().'": '.$value);
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
@@ -47,7 +56,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the claim value
|
||||
* Get the claim value.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -57,7 +66,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the claim name
|
||||
* Set the claim name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
@@ -70,7 +79,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the claim name
|
||||
* Get the claim name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -80,10 +89,10 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Claim value
|
||||
* Validate the Claim value.
|
||||
*
|
||||
* @param $value
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
@@ -91,7 +100,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a key value array comprising of the claim name and value
|
||||
* Build a key value array comprising of the claim name and value.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -101,7 +110,7 @@ abstract class Claim implements ClaimInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the claim as a string
|
||||
* Get the claim as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user