Token   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 24
dl 0
loc 92
c 0
b 0
f 0
ccs 26
cts 26
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getAccessToken() 0 3 1
A getInstanceUrl() 0 3 1
A getRefreshToken() 0 3 1
A getTokenType() 0 3 1
A unserialize() 0 8 1
A serialize() 0 7 1
A __construct() 0 6 1
1
<?php
2
3
namespace Xsolve\SalesforceClient\Security\Token;
4
5
/**
6
 * Basic implementation of TokenInterace.
7
 */
8
class Token implements TokenInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $tokenType;
14
15
    /**
16
     * @var string
17
     */
18
    protected $accessToken;
19
20
    /**
21
     * @var string
22
     */
23
    protected $refreshToken;
24
25
    /**
26
     * @var string
27
     */
28
    protected $instanceUrl;
29
30
    /**
31
     * @param string $tokenType
32
     * @param string $accessToken
33
     * @param string $instanceUrl
34
     * @param string $refreshToken
35
     */
36 3
    public function __construct(string $tokenType, string $accessToken, string $instanceUrl, string $refreshToken = '')
37
    {
38 3
        $this->tokenType = $tokenType;
39 3
        $this->accessToken = $accessToken;
40 3
        $this->refreshToken = $refreshToken;
41 3
        $this->instanceUrl = $instanceUrl;
42 3
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 1
    public function getTokenType(): string
48
    {
49 1
        return $this->tokenType;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55 1
    public function getAccessToken(): string
56
    {
57 1
        return $this->accessToken;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 1
    public function getRefreshToken(): string
64
    {
65 1
        return $this->refreshToken;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71 1
    public function getInstanceUrl(): string
72
    {
73 1
        return $this->instanceUrl;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79 1
    public function serialize(): string
80
    {
81 1
        return serialize([
82 1
            $this->tokenType,
83 1
            $this->accessToken,
84 1
            $this->instanceUrl,
85 1
            $this->refreshToken,
86
        ]);
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92 1
    public function unserialize($serialized)
93
    {
94
        list(
95 1
            $this->tokenType,
96 1
            $this->accessToken,
97 1
            $this->instanceUrl,
98 1
            $this->refreshToken
99 1
        ) = unserialize($serialized);
100 1
    }
101
}
102