Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
Token | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
toString | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * @section LICENSE |
4 | * Copyright (c) 2007 Andy Smith |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining |
7 | * a copy of this software and associated documentation files (the |
8 | * "Software"), to deal in the Software without restriction, including without |
9 | * limitation the rights to use, copy, modify, merge, publish, distribute, |
10 | * sublicense, and/or sell copies of the Software, and to permit persons to |
11 | * whom the Software is furnished to do so, subject to the following |
12 | * conditions: |
13 | * |
14 | * The above copyright notice and this permission notice shall be included in |
15 | * all copies or substantial portions of the Software. |
16 | * |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | * DEALINGS IN THE SOFTWARE. |
24 | * |
25 | * @file |
26 | */ |
27 | |
28 | namespace MediaWiki\OAuthClient; |
29 | |
30 | /** |
31 | * Data type that represents an End User via either and access or requst |
32 | * token. |
33 | */ |
34 | class Token { |
35 | /** |
36 | * @var string |
37 | */ |
38 | public $key; |
39 | |
40 | /** |
41 | * @var string |
42 | */ |
43 | public $secret; |
44 | |
45 | /** |
46 | * @param string $key The token |
47 | * @param string $secret The token secret |
48 | */ |
49 | public function __construct( $key, $secret ) { |
50 | $this->key = $key; |
51 | $this->secret = $secret; |
52 | } |
53 | |
54 | /** |
55 | * Generate the basic string serialization of a token that a server |
56 | * would respond to request_token and access_token calls with |
57 | * |
58 | * @return string |
59 | */ |
60 | public function toString() { |
61 | return 'oauth_token=' . Util::urlencode( $this->key ) . |
62 | '&oauth_token_secret=' . Util::urlencode( $this->secret ); |
63 | } |
64 | |
65 | public function __toString() { |
66 | return $this->toString(); |
67 | } |
68 | } |