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.
Passed
Push — master ( 2d0137...54f172 )
by Yong
12:14 queued 08:03
created

RsaKeyPairCredential   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 59
ccs 16
cts 16
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPublicKeyId() 0 3 1
A getPrivateKey() 0 3 1
A __construct() 0 12 2
A __toString() 0 3 1
1
<?php
2
3
namespace AlibabaCloud\Client\Credentials;
4
5
use Exception;
6
use AlibabaCloud\Client\SDK;
7
use AlibabaCloud\Client\Filter\CredentialFilter;
8
use AlibabaCloud\Client\Exception\ClientException;
9
10
/**
11
 * Use the RSA key pair to complete the authentication (supported only on Japanese site)
12
 *
13
 * @package   AlibabaCloud\Client\Credentials
14
 */
15
class RsaKeyPairCredential implements CredentialsInterface
16
{
17
18
    /**
19
     * @var string
20
     */
21
    private $publicKeyId;
22
23
    /**
24
     * @var string
25
     */
26
    private $privateKey;
27
28
    /**
29
     * RsaKeyPairCredential constructor.
30
     *
31
     * @param string $publicKeyId
32
     * @param string $privateKeyFile
33
     *
34
     * @throws ClientException
35
     */
36 24
    public function __construct($publicKeyId, $privateKeyFile)
37
    {
38 24
        CredentialFilter::publicKeyId($publicKeyId);
39 20
        CredentialFilter::privateKeyFile($privateKeyFile);
40
41 16
        $this->publicKeyId = $publicKeyId;
42
        try {
43 16
            $this->privateKey = file_get_contents($privateKeyFile);
44 16
        } catch (Exception $exception) {
45 3
            throw new ClientException(
46 3
                $exception->getMessage(),
47
                SDK::INVALID_CREDENTIAL
48 3
            );
49
        }
50 13
    }
51
52
    /**
53
     * @return mixed
54
     */
55 7
    public function getPrivateKey()
56
    {
57 7
        return $this->privateKey;
58
    }
59
60
    /**
61
     * @return string
62
     */
63 7
    public function getPublicKeyId()
64
    {
65 7
        return $this->publicKeyId;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 12
    public function __toString()
72
    {
73 12
        return "publicKeyId#$this->publicKeyId";
74
    }
75
}
76