Token::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * The MIT License
4
 * Copyright (c) 2007 Andy Smith
5
 */
6
namespace Abraham\TwitterOAuth;
7
8
class Token
9
{
10
    /** @var string */
11
    public $key;
12
    /** @var string */
13
    public $secret;
14
15
    /**
16
     * @param string $key    The OAuth Token
17
     * @param string $secret The OAuth Token Secret
18
     */
19
    public function __construct($key, $secret)
20
    {
21
        $this->key = $key;
22
        $this->secret = $secret;
23
    }
24
25
    /**
26
     * Generates the basic string serialization of a token that a server
27
     * would respond to request_token and access_token calls with
28
     *
29
     * @return string
30
     */
31
    public function __toString()
32
    {
33
        return sprintf("oauth_token=%s&oauth_token_secret=%s",
34
            Util::urlencodeRfc3986($this->key),
35
            Util::urlencodeRfc3986($this->secret)
36
        );
37
    }
38
}
39