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

Signature   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSignature() 0 4 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