Passed
Pull Request — master (#133)
by
unknown
04:08
created

Token::getKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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 27
    public function __construct($key, $secret)
27
    {
28 27
        $this->key = $key;
29 27
        $this->secret = $secret;
30 27
    }
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
    public function getKey()
51
    {
52
        return $this->key;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getSecret()
59
    {
60
        return $this->secret;
61
    }
62
}
63