Completed
Push — master ( 43966f...a8f3db )
by Pieter
03:10
created

Signature::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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 2
    public function __construct(BaseString $baseString, Key $key)
12
    {
13 2
        $this->baseString = $baseString->getString();
14 2
        $this->key        = $key->getKey();
15 2
    }
16
17 2
    public function getSignature(): string
18
    {
19 2
        return rawurlencode(base64_encode(hash_hmac('sha1', $this->baseString, $this->key, true)));
20
    }
21
}
22