Token   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 51
ccs 8
cts 13
cp 0.6153
rs 10
wmc 4

4 Methods

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