Debian Codegraph @

lib/3rdParty/composer/web-token/jwt-library/Checker/UnencodedPayloadChecker.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Jose\Component\Checker;
6
7 use function is_bool;
8
9 /**
10 * This class is a header parameter checker. When the "b64" is present, it will check if the value is a boolean or not.
11 *
12 * The use of this checker will allow the use of token with unencoded payload.
13 */
14 final class UnencodedPayloadChecker implements HeaderChecker
15 {
16 private const HEADER_NAME = 'b64';
17
18 public function checkHeader(mixed $value): void
19 {
20 if (! is_bool($value)) {
21 throw new InvalidHeaderException('"b64" must be a boolean.', self::HEADER_NAME, $value);
22 }
23 }
24
25 public function supportedHeader(): string
26 {
27 return self::HEADER_NAME;
28 }
29
30 public function protectedHeaderOnly(): bool
31 {
32 return true;
33 }
34 }