|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Risan\OAuth1\Config; |
|
4
|
|
|
|
|
5
|
|
|
use Risan\OAuth1\Credentials\ClientCredentials; |
|
6
|
|
|
|
|
7
|
|
|
class Config implements ConfigInterface |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* The ClientCredentials instance. |
|
11
|
|
|
* |
|
12
|
|
|
* @var \Risan\OAuth1\Credentials\ClientCredentials |
|
13
|
|
|
*/ |
|
14
|
|
|
protected $clientCredentials; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* The UriConfigInterface instance. |
|
18
|
|
|
* |
|
19
|
|
|
* @var \Risan\OAuth1\Config\UriConfigInterface |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $uri; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Create new instance of Config class. |
|
25
|
|
|
* |
|
26
|
|
|
* @param \Risan\OAuth1\Credentials\ClientCredentials $clientCredentials |
|
27
|
|
|
* @param \Risan\OAuth1\Config\UriConfigInterface $uri |
|
28
|
|
|
*/ |
|
29
|
14 |
|
public function __construct(ClientCredentials $clientCredentials, UriConfigInterface $uri) |
|
30
|
|
|
{ |
|
31
|
14 |
|
$this->clientCredentials = $clientCredentials; |
|
32
|
14 |
|
$this->uri = $uri; |
|
33
|
14 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritDoc} |
|
37
|
|
|
*/ |
|
38
|
4 |
|
public function getClientCredentials() |
|
39
|
|
|
{ |
|
40
|
4 |
|
return $this->clientCredentials; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritDoc} |
|
45
|
|
|
*/ |
|
46
|
2 |
|
public function getClientCredentialsIdentifier() |
|
47
|
|
|
{ |
|
48
|
2 |
|
return $this->getClientCredentials()->getIdentifier(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* {@inheritDoc} |
|
53
|
|
|
*/ |
|
54
|
2 |
|
public function getClientCredentialsSecret() |
|
55
|
|
|
{ |
|
56
|
2 |
|
return $this->getClientCredentials()->getSecret(); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* {@inheritDoc} |
|
61
|
|
|
*/ |
|
62
|
1 |
|
public function getUri() |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->uri; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* {@inheritDoc} |
|
69
|
|
|
*/ |
|
70
|
2 |
|
public function getTemporaryCredentialsUri() |
|
71
|
|
|
{ |
|
72
|
2 |
|
return $this->uri->forTemporaryCredentials(); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* {@inheritDoc} |
|
77
|
|
|
*/ |
|
78
|
2 |
|
public function getAuthorizationUri() |
|
79
|
|
|
{ |
|
80
|
2 |
|
return $this->uri->forAuthorization(); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* {@inheritDoc} |
|
85
|
|
|
*/ |
|
86
|
2 |
|
public function getTokenCredentialsUri() |
|
87
|
|
|
{ |
|
88
|
2 |
|
return $this->uri->forTokenCredentials(); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* {@inheritDoc} |
|
93
|
|
|
*/ |
|
94
|
2 |
|
public function getCallbackUri() |
|
95
|
|
|
{ |
|
96
|
2 |
|
return $this->uri->callback(); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* {@inheritDoc} |
|
101
|
|
|
*/ |
|
102
|
3 |
|
public function hasCallbackUri() |
|
103
|
|
|
{ |
|
104
|
3 |
|
return $this->uri->hasCallback(); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* {@inheritDoc} |
|
109
|
|
|
*/ |
|
110
|
1 |
|
public function buildUri($uri) |
|
111
|
|
|
{ |
|
112
|
1 |
|
return $this->uri->build($uri); |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|