| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 3 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | 15 | public static function validExtensionIdentifier(string $identifier): bool |
|
| 10 | { |
||
| 11 | // SPEC 9.1 |
||
| 12 | // All extension identifiers MUST be a maximum of 32 octets in length and MUST consist only of printable |
||
| 13 | // USASCII characters, excluding backslash and doublequote, i.e., VCHAR as defined in [RFC5234] but without |
||
| 14 | // %x22 and %x5c. Implementations MUST match WebAuthn extension identifiers in a case-sensitive fashion. |
||
| 15 | 15 | if (strlen($identifier) > self::MAX_IDENTIFIER_LENGHT) { |
|
| 16 | 1 | return false; |
|
| 17 | } |
||
| 18 | 15 | return (bool) preg_match('~^[\x21\x23-\x5B\x5D-\x7E]+$~', $identifier); |
|
| 19 | } |
||
| 21 |