OAuth1   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A authenticate() 0 4 1
1
<?php
2
3
namespace Xabbuh\Http\Authentication;
4
5
use ApiClients\Tools\Psr7\Oauth1\Definition\AccessToken;
6
use ApiClients\Tools\Psr7\Oauth1\Definition\TokenSecret;
7
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
8
use Http\Message\Authentication;
9
use Psr\Http\Message\RequestInterface;
10
11
/**
12
 * Adds a signed Authorization header using the configured OAuth1 request signer and credentials.
13
 *
14
 * @author Christian Flothmann <[email protected]>
15
 */
16
final class OAuth1 implements Authentication
17
{
18
    private $requestSigner;
19
20
    public function __construct(RequestSigner $requestSigner, AccessToken $accessToken, TokenSecret $tokenSecret)
21
    {
22
        $this->requestSigner = $requestSigner->withAccessToken($accessToken, $tokenSecret);
23
    }
24
25
    public function authenticate(RequestInterface $request)
26
    {
27
        return $this->requestSigner->sign($request);
28
    }
29
}
30