1 | <?php |
||
13 | abstract class AbstractAdapter |
||
14 | { |
||
15 | use LoggerTrait; |
||
16 | |||
17 | /** |
||
18 | * |
||
19 | * @var mixed |
||
20 | */ |
||
21 | protected $client; |
||
22 | |||
23 | /** |
||
24 | * |
||
25 | * @var Owner |
||
26 | */ |
||
27 | protected $owner; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * @var Configuration |
||
32 | */ |
||
33 | protected $configuration; |
||
34 | |||
35 | /** |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $credentials; |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * @var bool |
||
44 | */ |
||
45 | protected $isAuthenticated = false; |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * @param mixed $configuration |
||
50 | * @param Owner $owner |
||
51 | */ |
||
52 | public function __construct(Owner $owner, $configuration, LoggerInterface $logger = null) |
||
67 | |||
68 | /** |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | abstract protected function getVendor(); |
||
73 | |||
74 | /** |
||
75 | * |
||
76 | * @param string $key |
||
77 | * @param mixed $default |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function getConfiguration($key, $default = null) |
||
84 | |||
85 | /** |
||
86 | * |
||
87 | * @return \Doctrine\Common\Cache\Cache |
||
88 | */ |
||
89 | protected function getCache() |
||
93 | |||
94 | /** |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function getCredentials() |
||
119 | |||
120 | /** |
||
121 | * |
||
122 | * @param mixed $credentials |
||
123 | */ |
||
124 | public function setCredentials($credentials) |
||
135 | |||
136 | /** |
||
137 | * |
||
138 | * @return boolean |
||
139 | */ |
||
140 | public function isAuthenticated() |
||
144 | |||
145 | /** |
||
146 | * Maps an Asset to a Provider resource identifier |
||
147 | * |
||
148 | * @param Asset $asset |
||
149 | * @param $identifier |
||
150 | */ |
||
151 | protected function remember(Asset $asset, $identifier) |
||
167 | |||
168 | /** |
||
169 | * Returns the Provider identifier of an Asset if exists, or `false` otherwise |
||
170 | * |
||
171 | * @param Asset $asset |
||
172 | * @return string|null |
||
173 | */ |
||
174 | protected function retrieve(Asset $asset) |
||
190 | |||
191 | /** |
||
192 | * Remove an Asset from the map |
||
193 | * |
||
194 | * @param Asset $asset |
||
195 | */ |
||
196 | protected function forget(Asset $asset) |
||
213 | |||
214 | /** |
||
215 | * |
||
216 | * @param string $url |
||
217 | * @param bool $from_client |
||
218 | * @throws \Exception |
||
219 | */ |
||
220 | public function redirect($url, $from_client = false) |
||
236 | } |
||
237 |