Token::getKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 0
crap 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 34
    }
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