Token   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 51
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSecret() 0 3 1
A getKey() 0 3 1
A __construct() 0 4 1
A __toString() 0 6 1
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry https://github.com/ovr <[email protected]>
5
 */
6
declare(strict_types=1);
7
8
namespace SocialConnect\OAuth1;
9
10
class Token
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $key;
16
17
    /**
18
     * @var string
19
     */
20
    protected $secret;
21
22
    /**
23
     * @param string $key
24
     * @param string $secret
25
     */
26 34
    public function __construct($key, $secret)
27
    {
28 34
        $this->key = $key;
29 34
        $this->secret = $secret;
30
    }
31
32
    /**
33
     * Generates the basic string serialization of a token that a server
34
     * would respond to request_token and access_token calls with
35
     *
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        return sprintf(
41
            "oauth_token=%s&oauth_token_secret=%s",
42
            Util::urldecodeRFC3986($this->key),
43
            Util::urldecodeRFC3986($this->secret)
44
        );
45
    }
46
47
    /**
48
     * @return string
49
     */
50 2
    public function getKey()
51
    {
52 2
        return $this->key;
53
    }
54
55
    /**
56
     * @return string
57
     */
58 6
    public function getSecret()
59
    {
60 6
        return $this->secret;
61
    }
62
}
63