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.

RSASignature::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\CryptoTypes\Signature;
6
7
use Sop\ASN1\Type\Primitive\BitString;
8
9
/**
10
 * Implements RSA signature value.
11
 *
12
 * @todo Implement signature parsing
13
 *
14
 * @see https://tools.ietf.org/html/rfc2313#section-10
15
 */
16
class RSASignature extends Signature
17
{
18
    /**
19
     * Signature value *S*.
20
     *
21
     * @var string
22
     */
23
    private $_signature;
24
25
    /**
26
     * Constructor.
27
     */
28 2
    protected function __construct()
29
    {
30 2
    }
31
32
    /**
33
     * Initialize from RSA signature *S*.
34
     *
35
     * Signature value *S* is the result of last step in RSA signature
36
     * process defined in PKCS #1.
37
     *
38
     * @see https://tools.ietf.org/html/rfc2313#section-10.1.4
39
     *
40
     * @param string $signature Signature bits
41
     *
42
     * @return self
43
     */
44 2
    public static function fromSignatureString(string $signature): Signature
45
    {
46 2
        $obj = new self();
47 2
        $obj->_signature = strval($signature);
48 2
        return $obj;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function bitString(): BitString
55
    {
56 1
        return new BitString($this->_signature);
57
    }
58
}
59