Signature::getSignature()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace PeeHaa\AsyncTwitter\Oauth\Signature;
4
5
class Signature
6
{
7
    private $baseString;
8
9
    private $key;
10
11 6
    public function __construct(BaseString $baseString, Key $key)
12
    {
13 6
        $this->baseString = $baseString->getString();
14 6
        $this->key        = $key->getKey();
15
    }
16
17 6
    public function getSignature(): string
18
    {
19 6
        return rawurlencode(base64_encode(hash_hmac('sha1', $this->baseString, $this->key, true)));
20
    }
21
}
22