@@ -13,24 +13,24 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class AudienceClaim extends RegisteredClaim |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Constructor. |
|
| 18 | - * |
|
| 19 | - * @param string ...$audiences One or more audiences |
|
| 20 | - */ |
|
| 21 | - public function __construct(string ...$audiences) |
|
| 22 | - { |
|
| 23 | - parent::__construct(self::NAME_AUDIENCE, $audiences, |
|
| 24 | - new ContainsValidator()); |
|
| 25 | - } |
|
| 16 | + /** |
|
| 17 | + * Constructor. |
|
| 18 | + * |
|
| 19 | + * @param string ...$audiences One or more audiences |
|
| 20 | + */ |
|
| 21 | + public function __construct(string ...$audiences) |
|
| 22 | + { |
|
| 23 | + parent::__construct(self::NAME_AUDIENCE, $audiences, |
|
| 24 | + new ContainsValidator()); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * |
|
| 29 | - * {@inheritdoc} |
|
| 30 | - */ |
|
| 31 | - public static function fromJSONValue($value): self |
|
| 32 | - { |
|
| 33 | - $value = (array) $value; |
|
| 34 | - return new self(...$value); |
|
| 35 | - } |
|
| 27 | + /** |
|
| 28 | + * |
|
| 29 | + * {@inheritdoc} |
|
| 30 | + */ |
|
| 31 | + public static function fromJSONValue($value): self |
|
| 32 | + { |
|
| 33 | + $value = (array) $value; |
|
| 34 | + return new self(...$value); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -13,25 +13,25 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class IssuedAtClaim extends RegisteredClaim |
| 15 | 15 | { |
| 16 | - use NumericDateClaim; |
|
| 16 | + use NumericDateClaim; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructor. |
|
| 20 | - * |
|
| 21 | - * @param int $issue_time Issued at time |
|
| 22 | - */ |
|
| 23 | - public function __construct(int $issue_time) |
|
| 24 | - { |
|
| 25 | - parent::__construct(self::NAME_ISSUED_AT, $issue_time); |
|
| 26 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructor. |
|
| 20 | + * |
|
| 21 | + * @param int $issue_time Issued at time |
|
| 22 | + */ |
|
| 23 | + public function __construct(int $issue_time) |
|
| 24 | + { |
|
| 25 | + parent::__construct(self::NAME_ISSUED_AT, $issue_time); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Initialize with time set to current time |
|
| 30 | - * |
|
| 31 | - * @return self |
|
| 32 | - */ |
|
| 33 | - public static function now(): self |
|
| 34 | - { |
|
| 35 | - return new self(time()); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Initialize with time set to current time |
|
| 30 | + * |
|
| 31 | + * @return self |
|
| 32 | + */ |
|
| 33 | + public static function now(): self |
|
| 34 | + { |
|
| 35 | + return new self(time()); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class GreaterValidator extends Validator |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - */ |
|
| 16 | - public function validate($value, $constraint): bool |
|
| 17 | - { |
|
| 18 | - return $value > $constraint; |
|
| 19 | - } |
|
| 12 | + /** |
|
| 13 | + * |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + */ |
|
| 16 | + public function validate($value, $constraint): bool |
|
| 17 | + { |
|
| 18 | + return $value > $constraint; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -9,24 +9,24 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | abstract class Validator |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Check whether value is valid by given constraint. |
|
| 14 | - * |
|
| 15 | - * @param mixed $value Value to assert |
|
| 16 | - * @param mixed $constraint Constraint |
|
| 17 | - * @return bool True if value is valid |
|
| 18 | - */ |
|
| 19 | - abstract public function validate($value, $constraint): bool; |
|
| 12 | + /** |
|
| 13 | + * Check whether value is valid by given constraint. |
|
| 14 | + * |
|
| 15 | + * @param mixed $value Value to assert |
|
| 16 | + * @param mixed $constraint Constraint |
|
| 17 | + * @return bool True if value is valid |
|
| 18 | + */ |
|
| 19 | + abstract public function validate($value, $constraint): bool; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Functor method. |
|
| 23 | - * |
|
| 24 | - * @param mixed $value |
|
| 25 | - * @param mixed $constraint |
|
| 26 | - * @return bool |
|
| 27 | - */ |
|
| 28 | - public function __invoke($value, $constraint): bool |
|
| 29 | - { |
|
| 30 | - return $this->validate($value, $constraint); |
|
| 31 | - } |
|
| 21 | + /** |
|
| 22 | + * Functor method. |
|
| 23 | + * |
|
| 24 | + * @param mixed $value |
|
| 25 | + * @param mixed $constraint |
|
| 26 | + * @return bool |
|
| 27 | + */ |
|
| 28 | + public function __invoke($value, $constraint): bool |
|
| 29 | + { |
|
| 30 | + return $this->validate($value, $constraint); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class ContainsValidator extends Validator |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * |
|
| 17 | - * {@inheritdoc} |
|
| 18 | - */ |
|
| 19 | - public function validate($value, $constraint): bool |
|
| 20 | - { |
|
| 21 | - if (is_array($value)) { |
|
| 22 | - return in_array($constraint, $value); |
|
| 23 | - } |
|
| 24 | - return $value == $constraint; |
|
| 25 | - } |
|
| 15 | + /** |
|
| 16 | + * |
|
| 17 | + * {@inheritdoc} |
|
| 18 | + */ |
|
| 19 | + public function validate($value, $constraint): bool |
|
| 20 | + { |
|
| 21 | + if (is_array($value)) { |
|
| 22 | + return in_array($constraint, $value); |
|
| 23 | + } |
|
| 24 | + return $value == $constraint; |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class LessOrEqualValidator extends Validator |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * |
|
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 17 | - public function validate($value, $constraint): bool |
|
| 18 | - { |
|
| 19 | - return $value <= $constraint; |
|
| 20 | - } |
|
| 13 | + /** |
|
| 14 | + * |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | + public function validate($value, $constraint): bool |
|
| 18 | + { |
|
| 19 | + return $value <= $constraint; |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class LessValidator extends Validator |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - */ |
|
| 16 | - public function validate($value, $constraint): bool |
|
| 17 | - { |
|
| 18 | - return $value < $constraint; |
|
| 19 | - } |
|
| 12 | + /** |
|
| 13 | + * |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + */ |
|
| 16 | + public function validate($value, $constraint): bool |
|
| 17 | + { |
|
| 18 | + return $value < $constraint; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class EqualsValidator extends Validator |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * |
|
| 14 | - * {@inheritdoc} |
|
| 15 | - */ |
|
| 16 | - public function validate($value, $constraint): bool |
|
| 17 | - { |
|
| 18 | - return $value == $constraint; |
|
| 19 | - } |
|
| 12 | + /** |
|
| 13 | + * |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + */ |
|
| 16 | + public function validate($value, $constraint): bool |
|
| 17 | + { |
|
| 18 | + return $value == $constraint; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class GreaterOrEqualValidator extends Validator |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * |
|
| 15 | - * {@inheritdoc} |
|
| 16 | - */ |
|
| 17 | - public function validate($value, $constraint): bool |
|
| 18 | - { |
|
| 19 | - return $value >= $constraint; |
|
| 20 | - } |
|
| 13 | + /** |
|
| 14 | + * |
|
| 15 | + * {@inheritdoc} |
|
| 16 | + */ |
|
| 17 | + public function validate($value, $constraint): bool |
|
| 18 | + { |
|
| 19 | + return $value >= $constraint; |
|
| 20 | + } |
|
| 21 | 21 | } |