Skip to content

Commit 073a98a

Browse files
authored
chore: make internal constants private (#374)
1 parent 86d8310 commit 073a98a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/JWT.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
*/
2626
class JWT
2727
{
28-
const ASN1_INTEGER = 0x02;
29-
const ASN1_SEQUENCE = 0x10;
30-
const ASN1_BIT_STRING = 0x03;
28+
// const ASN1_INTEGER = 0x02;
29+
// const ASN1_SEQUENCE = 0x10;
30+
// const ASN1_BIT_STRING = 0x03;
31+
private static $asn1Integer = 0x02;
32+
private static $asn1Sequence = 0x10;
33+
private static $asn1BitString = 0x03;
3134

3235
/**
3336
* When checking nbf, iat or expiration times,
@@ -494,9 +497,9 @@ private static function signatureToDER($sig)
494497
}
495498

496499
return self::encodeDER(
497-
self::ASN1_SEQUENCE,
498-
self::encodeDER(self::ASN1_INTEGER, $r) .
499-
self::encodeDER(self::ASN1_INTEGER, $s)
500+
self::$asn1Sequence,
501+
self::encodeDER(self::$asn1Integer, $r) .
502+
self::encodeDER(self::$asn1Integer, $s)
500503
);
501504
}
502505

@@ -510,7 +513,7 @@ private static function signatureToDER($sig)
510513
private static function encodeDER($type, $value)
511514
{
512515
$tag_header = 0;
513-
if ($type === self::ASN1_SEQUENCE) {
516+
if ($type === self::$asn1Sequence) {
514517
$tag_header |= 0x20;
515518
}
516519

@@ -575,7 +578,7 @@ private static function readDER($der, $offset = 0)
575578
}
576579

577580
// Value
578-
if ($type == self::ASN1_BIT_STRING) {
581+
if ($type == self::$asn1BitString) {
579582
$pos++; // Skip the first contents octet (padding indicator)
580583
$data = \substr($der, $pos, $len - 1);
581584
$pos += $len - 1;

0 commit comments

Comments
 (0)