Token::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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