AbstractAuthentication   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getHeaders() 0 4 1
A getQueryParameters() 0 4 1
A getTokenInstance() 0 4 1
A setQueryString() 0 5 1
1
<?php
2
/**
3
 * This file is part of the adlogix/guzzle-atlassian-connect-middleware package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Adlogix\GuzzleAtlassianConnect\Security;
10
11
use Adlogix\GuzzleAtlassianConnect\Entity\JwtToken;
12
13
/**
14
 * Class AbstractAuthentication
15
 * @package Adlogix\GuzzleAtlassianConnect\Security
16
 * @author  Cedric Michaux <[email protected]>
17
 */
18
abstract class AbstractAuthentication implements AuthenticationInterface
19
{
20
    /**
21
     * @var JwtToken
22
     */
23
    protected $token;
24
25
    /**
26
     * AbstractAuthentication constructor.
27
     *
28
     * @param string $key
29
     * @param string $sharedSecret
30
     */
31
    public function __construct($key, $sharedSecret)
32
    {
33
        $this->token = new JwtToken($key, $sharedSecret);
34
    }
35
    
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function getHeaders()
40
    {
41
        return [];
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getQueryParameters()
48
    {
49
        return [];
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getTokenInstance()
56
    {
57
        return $this->token;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function setQueryString($method, $url)
64
    {
65
        $this->token->setQueryString($method, $url);
66
        return $this;
67
    }
68
}
69