GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (5)

lib/JWX/Util/BigInt.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\JWX\Util;
6
7
/**
8
 * Class for handling big integers.
9
 */
10
class BigInt
11
{
12
    /**
13
     * Number.
14
     *
15
     * @var \GMP
16
     */
17
    protected $_num;
18
19
    /**
20
     * Constructor.
21
     *
22
     * @param \GMP $num GMP number
23
     */
24 49
    protected function __construct(\GMP $num)
25
    {
26 49
        $this->_num = $num;
27 49
    }
28
29 2
    public function __toString(): string
30
    {
31 2
        return $this->base10();
32
    }
33
34
    /**
35
     * Initialize from a base10 number.
36
     *
37
     * @param int|string $number
38
     */
39 18
    public static function fromBase10($number): self
40
    {
41 18
        $num = gmp_init($number, 10);
42 18
        return new self($num);
0 ignored issues
show
It seems like $num can also be of type resource; however, parameter $num of Sop\JWX\Util\BigInt::__construct() does only seem to accept GMP, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
        return new self(/** @scrutinizer ignore-type */ $num);
Loading history...
43
    }
44
45
    /**
46
     * Initialize from a base256 number.
47
     *
48
     * Base64 number is an octet string of big endian, most significant word
49
     * first integer.
50
     */
51 33
    public static function fromBase256(string $octets): self
52
    {
53 33
        $num = gmp_import($octets, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
54 33
        return new self($num);
55
    }
56
57
    /**
58
     * Convert to base10 string.
59
     */
60 34
    public function base10(): string
61
    {
62 34
        return gmp_strval($this->_num, 10);
63
    }
64
65
    /**
66
     * Convert to base16 string.
67
     */
68 1
    public function base16(): string
69
    {
70 1
        return gmp_strval($this->_num, 16);
71
    }
72
73
    /**
74
     * Convert to base256 string.
75
     */
76 19
    public function base256(): string
77
    {
78 19
        return gmp_export($this->_num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
79
    }
80
}
81