1 | <?php |
||
9 | class UriConfig implements UriConfigInterface |
||
|
|||
10 | { |
||
11 | /** |
||
12 | * The UriParserInterface implementation. |
||
13 | * |
||
14 | * @return \Risan\OAuth1\UriParserInterface |
||
15 | */ |
||
16 | protected $parser; |
||
17 | |||
18 | /** |
||
19 | * The base URI. |
||
20 | * |
||
21 | * @var \Psr\Http\Message\UriInterface|null |
||
22 | */ |
||
23 | protected $base; |
||
24 | |||
25 | /** |
||
26 | * The URI for obtaining temporary credentials. Also known as request token |
||
27 | * URI. |
||
28 | * |
||
29 | * @var \Psr\Http\Message\UriInterface |
||
30 | */ |
||
31 | protected $temporaryCredentials; |
||
32 | |||
33 | /** |
||
34 | * The URI for asking user to authorize the request. |
||
35 | * |
||
36 | * @var \Psr\Http\Message\UriInterface |
||
37 | */ |
||
38 | protected $authorization; |
||
39 | |||
40 | /** |
||
41 | * The URI for obtaining token credentials. Also known as access token |
||
42 | * URI. |
||
43 | * |
||
44 | * @var \Psr\Http\Message\UriInterface |
||
45 | */ |
||
46 | protected $tokenCredentials; |
||
47 | |||
48 | /** |
||
49 | * The callback URI. |
||
50 | * |
||
51 | * @var \Psr\Http\Message\UriInterface|null |
||
52 | */ |
||
53 | protected $callback; |
||
54 | |||
55 | /** |
||
56 | * Create UriConfig instance. |
||
57 | * |
||
58 | * @param array $uris |
||
59 | * @param \Risan\OAuth1\UriParserInterface |
||
60 | */ |
||
61 | public function __construct(array $uris, UriParserInterface $parser) |
||
66 | |||
67 | /** |
||
68 | * Set URIs from an array. |
||
69 | * |
||
70 | * @param array $uris |
||
71 | * @return \Risan\OAuth1\Config\UriConfig |
||
72 | */ |
||
73 | public function setFromArray(array $uris) |
||
91 | |||
92 | /** |
||
93 | * Validate the given URI array. |
||
94 | * |
||
95 | * @param array $uris |
||
96 | * @return boolean |
||
97 | * @throws \InvalidArgumentException |
||
98 | */ |
||
99 | public function validateUris(array $uris) |
||
115 | |||
116 | /** |
||
117 | * Set the base URI. |
||
118 | * |
||
119 | * @param \Psr\Http\Message\UriInterface $uri |
||
120 | * @return \Risan\OAuth1\Config\UriConfig |
||
121 | * @throws \InvalidArgumentException |
||
122 | */ |
||
123 | public function setBase(UriInterface $uri) |
||
133 | |||
134 | /** |
||
135 | * {@inheritDoc} |
||
136 | */ |
||
137 | public function base() |
||
141 | |||
142 | /** |
||
143 | * {@inheritDoc} |
||
144 | */ |
||
145 | public function hasBase() |
||
149 | |||
150 | /** |
||
151 | * {@inheritDoc} |
||
152 | */ |
||
153 | public function temporaryCredentials() |
||
157 | |||
158 | /** |
||
159 | * {@inheritDoc} |
||
160 | */ |
||
161 | public function authorization() |
||
165 | |||
166 | /** |
||
167 | * {@inheritDoc} |
||
168 | */ |
||
169 | public function tokenCredentials() |
||
173 | |||
174 | /** |
||
175 | * {@inheritDoc} |
||
176 | */ |
||
177 | public function callback() |
||
181 | |||
182 | /** |
||
183 | * {@inheritDoc} |
||
184 | */ |
||
185 | public function hasCallback() |
||
189 | |||
190 | /** |
||
191 | * Parse and build the given URI. |
||
192 | * |
||
193 | * @param \Psr\Http\Message\UriInterface|string $uri |
||
194 | * @return \Psr\Http\Message\UriInterface |
||
195 | */ |
||
196 | public function build($uri) |
||
206 | |||
207 | /** |
||
208 | * Check if the given URI should be resolved to absolute URI. |
||
209 | * |
||
210 | * @param \Psr\Http\Message\UriInterface $uri |
||
211 | * @return boolean |
||
212 | */ |
||
213 | public function shouldBeResolvedToAbsoluteUri(UriInterface $uri) |
||
217 | } |
||
218 |