Assert\Assertion::lessOrEqualThan PHP 메소드

lessOrEqualThan() 공개 정적인 메소드

Determines if the value is less or than given limit.
public static lessOrEqualThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$limit mixed
$message null
$propertyPath null
리턴 boolean
    public static function lessOrEqualThan($value, $limit, $message = null, $propertyPath = null)
    {
        if ($value > $limit) {
            $message = sprintf($message ?: 'Provided "%s" is not less or equal than "%s".', static::stringify($value), static::stringify($limit));
            throw static::createException($value, $message, static::INVALID_LESS_OR_EQUAL, $propertyPath);
        }
        return true;
    }

Usage Example

예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function checkClaim(JWTInterface $jwt)
 {
     if (!$jwt->hasClaim('iat')) {
         return [];
     }
     $iat = (int) $jwt->getClaim('iat');
     Assertion::lessOrEqualThan($iat, time(), 'The JWT is issued in the future.');
     return ['iat'];
 }
All Usage Examples Of Assert\Assertion::lessOrEqualThan