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.

ShaHmac1Signature   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getMethod() 0 3 1
A getVersion() 0 3 1
A sign() 0 3 1
1
<?php
2
3
namespace AlibabaCloud\Client\Signature;
4
5
/**
6
 * Class ShaHmac1Signature
7
 *
8
 * @package   AlibabaCloud\Signature
9
 */
10
class ShaHmac1Signature extends Signature implements SignatureInterface
11
{
12
13
    /**
14
     * @return string
15
     */
16 66
    public function getMethod()
17
    {
18 66
        return 'HMAC-SHA1';
19
    }
20
21
    /**
22
     * @return string
23
     */
24 64
    public function getType()
25
    {
26 64
        return '';
27
    }
28
29
    /**
30
     * @return string
31
     */
32 66
    public function getVersion()
33
    {
34 66
        return '1.0';
35
    }
36
37
    /**
38
     * @param string $string
39
     * @param string $accessKeySecret
40
     *
41
     * @return string
42
     */
43 66
    public function sign($string, $accessKeySecret)
44
    {
45 66
        return base64_encode(hash_hmac('sha1', $string, $accessKeySecret, true));
46
    }
47
}
48