1 | <?php |
||
12 | class ProtocolParameter implements ProtocolParameterInterface |
||
13 | { |
||
14 | /** |
||
15 | * The ConfigInterface instance. |
||
16 | * |
||
17 | * @var \Risan\OAuth1\Config\ConfigInterface |
||
18 | */ |
||
19 | protected $config; |
||
20 | |||
21 | /** |
||
22 | * The SignerInterface instance. |
||
23 | * |
||
24 | * @var \Risan\OAuth1\Signature\SignerInterface |
||
25 | */ |
||
26 | protected $signer; |
||
27 | |||
28 | /** |
||
29 | * The NonceGeneratorInterface instance. |
||
30 | * |
||
31 | * @var \Risan\OAuth1\Request\NonceGeneratorInterface |
||
32 | */ |
||
33 | protected $nonceGenerator; |
||
34 | |||
35 | /** |
||
36 | * Create ProtocolParameter instance. |
||
37 | * |
||
38 | * @param \Risan\OAuth1\ConfigInterface $config |
||
39 | * @param \Risan\OAuth1\Signature\SignerInterface $signer |
||
40 | * @param \Risan\OAuth1\Request\NonceGeneratorInterface $nonceGenerator |
||
41 | */ |
||
42 | 19 | public function __construct(ConfigInterface $config, SignerInterface $signer, NonceGeneratorInterface $nonceGenerator) |
|
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | 1 | public function getConfig() |
|
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | 1 | public function getSigner() |
|
64 | |||
65 | /** |
||
66 | * {@inheritDoc} |
||
67 | */ |
||
68 | 1 | public function getNonceGenerator() |
|
72 | |||
73 | /** |
||
74 | * {@inheritDoc} |
||
75 | */ |
||
76 | 1 | public function getCurrentTimestamp() |
|
80 | |||
81 | /** |
||
82 | * {@inheritDoc} |
||
83 | */ |
||
84 | 2 | public function getVersion() |
|
88 | |||
89 | /** |
||
90 | * {@inheritDoc} |
||
91 | */ |
||
92 | 1 | public function getBase() |
|
102 | |||
103 | /** |
||
104 | * {@inheritDoc} |
||
105 | */ |
||
106 | 1 | public function forTemporaryCredentials() |
|
118 | |||
119 | /** |
||
120 | * {@inheritDoc} |
||
121 | */ |
||
122 | 1 | public function forTokenCredentials(TemporaryCredentials $temporaryCredentials, $verificationCode) |
|
141 | |||
142 | /** |
||
143 | * {@inheritDoc} |
||
144 | */ |
||
145 | 1 | public function forProtectedResource(TokenCredentials $tokenCredentials, $httpMethod, $uri, array $requestOptions = []) |
|
161 | |||
162 | /** |
||
163 | * {@inheritDoc} |
||
164 | */ |
||
165 | 1 | public function getSignature(array $protocolParameters, $uri, ServerIssuedCredentials $serverIssuedCredentials = null, array $requestOptions = [], $httpMethod = 'POST') |
|
172 | |||
173 | /** |
||
174 | * Build the signature parameters to be signed. |
||
175 | * |
||
176 | * @param array $protocolParameters |
||
177 | * @param array $requestOptions |
||
178 | * @return array |
||
179 | */ |
||
180 | 1 | public function signatureParameters(array $protocolParameters, array $requestOptions = []) |
|
194 | |||
195 | /** |
||
196 | * Setup the signer. |
||
197 | * |
||
198 | * @param \Risan\OAuth1\Credentials\ServerIssuedCredentials|null $serverIssuedCredentials |
||
199 | * @return \Risan\OAuth1\Signature\SignerInterface |
||
200 | */ |
||
201 | 1 | public function setupSigner(ServerIssuedCredentials $serverIssuedCredentials = null) |
|
213 | |||
214 | /** |
||
215 | * Should sign with the client credentials. |
||
216 | * |
||
217 | * @return boolean |
||
218 | */ |
||
219 | 2 | public function shouldSignWithClientCredentials() |
|
223 | |||
224 | /** |
||
225 | * Should sign with the server issued credentials. |
||
226 | * |
||
227 | * @param \Risan\OAuth1\Credentials\ServerIssuedCredentials|null $serverIssuedCredentials |
||
228 | * @return boolean |
||
229 | */ |
||
230 | 2 | public function shouldSignWithServerIssuedCredentials(ServerIssuedCredentials $serverIssuedCredentials = null) |
|
234 | |||
235 | /** |
||
236 | * Check if request options has the given key option. |
||
237 | * |
||
238 | * @param array $requestOptions |
||
239 | * @param string $key |
||
240 | * @return boolean |
||
241 | */ |
||
242 | 2 | public function requestOptionsHas(array $requestOptions, $key) |
|
248 | } |
||
249 |