Passed
Push — feature/hmac-sha1 ( 4f9aa4 )
by Ion
02:15
created

HmacSHA1Digest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A sign() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace IonBazan\AliyunSigner\Digest;
6
7
class HmacSHA1Digest implements DigestInterface
8
{
9
    public function sign(string $message, string $secret): string
10
    {
11
        return base64_encode(hash_hmac('sha1', $message, $secret, true));
12
    }
13
14
    public function getMethod(): string
15
    {
16
        return 'HmacSHA1';
17
    }
18
}
19