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
|
|
|
public function __construct(ClientCredentials $clientCredentials, UriConfigInterface $uri) |
30
|
|
|
{ |
31
|
|
|
$this->clientCredentials = $clientCredentials; |
32
|
|
|
$this->uri = $uri; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritDoc} |
37
|
|
|
*/ |
38
|
|
|
public function getClientCredentials() |
39
|
|
|
{ |
40
|
|
|
return $this->clientCredentials; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritDoc} |
45
|
|
|
*/ |
46
|
|
|
public function getClientCredentialsIdentifier() |
47
|
|
|
{ |
48
|
|
|
return $this->getClientCredentials()->getIdentifier(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* {@inheritDoc} |
53
|
|
|
*/ |
54
|
|
|
public function getClientCredentialsSecret() |
55
|
|
|
{ |
56
|
|
|
return $this->getClientCredentials()->getSecret(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* {@inheritDoc} |
61
|
|
|
*/ |
62
|
|
|
public function getUri() |
63
|
|
|
{ |
64
|
|
|
return $this->uri; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* {@inheritDoc} |
69
|
|
|
*/ |
70
|
|
|
public function getTemporaryCredentialsUri() |
71
|
|
|
{ |
72
|
|
|
return $this->uri->forTemporaryCredentials(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritDoc} |
77
|
|
|
*/ |
78
|
|
|
public function getAuthorizationUri() |
79
|
|
|
{ |
80
|
|
|
return $this->uri->forAuthorization(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritDoc} |
85
|
|
|
*/ |
86
|
|
|
public function getTokenCredentialsUri() |
87
|
|
|
{ |
88
|
|
|
return $this->uri->forTokenCredentials(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritDoc} |
93
|
|
|
*/ |
94
|
|
|
public function getCallbackUri() |
95
|
|
|
{ |
96
|
|
|
return $this->uri->callback(); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritDoc} |
101
|
|
|
*/ |
102
|
|
|
public function hasCallbackUri() |
103
|
|
|
{ |
104
|
|
|
return $this->uri->hasCallback(); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|