1 | <?php |
||
15 | * |
||
16 | * @var \Risan\OAuth1\Request\RequestConfigInterface |
||
17 | */ |
||
18 | protected $requestConfig; |
||
19 | |||
20 | /** |
||
21 | * The HttpClientInterface instance. |
||
22 | * |
||
23 | * @var \Risan\OAuth1\HttpClientInterface |
||
24 | */ |
||
25 | protected $httpClient; |
||
26 | |||
27 | /** |
||
28 | * The CredentialsFactoryInterface instance. |
||
29 | * |
||
30 | * @var \Risan\OAuth1\Credentials\CredentialsFactoryInterface |
||
31 | */ |
||
32 | protected $credentialsFactory; |
||
33 | |||
34 | /** |
||
35 | * Create a new OAuth1 instance. |
||
36 | * |
||
37 | * @param \Risan\OAuth1\Request\RequestConfigInterface $requestConfig |
||
38 | * @param \Risan\OAuth1\HttpClientInterface $httpClient |
||
39 | * @param \Risan\OAuth1\Credentials\CredentialsFactoryInterface $credentialsFactory |
||
40 | */ |
||
41 | public function __construct(RequestConfigInterface $requestConfig, HttpClientInterface $httpClient, CredentialsFactoryInterface $credentialsFactory) |
||
42 | { |
||
43 | $this->requestConfig = $requestConfig; |
||
44 | $this->httpClient = $httpClient; |
||
45 | $this->credentialsFactory = $credentialsFactory; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | 59 | * {@inheritDoc} |
|
50 | */ |
||
51 | 59 | public function getRequestConfig() |
|
52 | 59 | { |
|
53 | 59 | return $this->requestConfig; |
|
54 | 1 | } |
|
55 | |||
56 | /** |
||
57 | 59 | * {@inheritDoc} |
|
58 | 59 | */ |
|
59 | 59 | public function getHttpClient() |
|
60 | { |
||
61 | return $this->httpClient; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritDoc} |
||
66 | 14 | */ |
|
67 | public function getCredentialsFactory() |
||
68 | 14 | { |
|
69 | 14 | return $this->credentialsFactory; |
|
70 | 14 | } |
|
71 | |||
72 | 14 | /** |
|
73 | * {@inheritDoc} |
||
74 | */ |
||
75 | public function getTemporaryCredentials() |
||
76 | { |
||
77 | $response = $this->httpClient->post($this->requestConfig->getTemporaryCredentialsUrl(), [ |
||
78 | 'headers' => [ |
||
79 | 'Authorization' => $this->requestConfig->getTemporaryCredentialsAuthorizationHeader(), |
||
80 | 43 | ], |
|
81 | ]); |
||
82 | 43 | ||
83 | return $this->credentialsFactory->createTemporaryCredentialsFromResponse($response); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * {@inheritDoc} |
||
88 | */ |
||
89 | public function buildAuthorizationUrl(TemporaryCredentials $temporaryCredentials) |
||
93 | 19 | ||
94 | 19 | /** |
|
95 | * {@inheritDoc} |
||
96 | 19 | */ |
|
97 | public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, $temporaryIdentifier, $verificationCode) |
||
98 | { |
||
114 | } |
||
115 |