Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
AbstractService.php
01 <?php
02
03 namespace OAuth\Common\Service;
04
05 use OAuth\Common\Consumer\CredentialsInterface;
06 use OAuth\Common\Exception\Exception;
07 use OAuth\Common\Http\Client\ClientInterface;
08 use OAuth\Common\Http\Uri\Uri;
09 use OAuth\Common\Http\Uri\UriInterface;
10 use OAuth\Common\Storage\TokenStorageInterface;
11
12 /**
13 * Abstract OAuth service, version-agnostic.
14 */
15 abstract class AbstractService implements ServiceInterface
16 {
17 /** @var CredentialsInterface */
18 protected $credentials;
19
20 /** @var ClientInterface */
21 protected $httpClient;
22
23 /** @var TokenStorageInterface */
24 protected $storage;
25
26 public function __construct(
27 CredentialsInterface $credentials,
28 ClientInterface $httpClient,
29 TokenStorageInterface $storage
30 ) {
31 $this->credentials = $credentials;
32 $this->httpClient = $httpClient;
33 $this->storage = $storage;
34 }
35
36 /**
37 * @param string|UriInterface $path
38 * @param UriInterface $baseApiUri
39 *
40 * @return UriInterface
41 */
42 protected function determineRequestUriFromPath($path, ?UriInterface $baseApiUri = null)
43 {
44 if ($path instanceof UriInterface) {
45 $uri = $path;
46 } elseif (stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0) {
47 $uri = new Uri($path);
48 } else {
49 if (null === $baseApiUri) {
50 throw new Exception(
51 'An absolute URI must be passed to ServiceInterface::request as no baseApiUri is set.'
52 );
53 }
54
55 $uri = clone $baseApiUri;
56 if (false !== strpos($path, '?')) {
57 $parts = explode('?', $path, 2);
58 $path = $parts[0];
59 $query = $parts[1];
60 $uri->setQuery($query);
61 }
62
63 if ($path[0] === '/') {
64 $path = substr($path, 1);
65 }
66
67 $uri->setPath($uri->getPath() . $path);
68 }
69
70 return $uri;
71 }
72
73 /**
74 * Accessor to the storage adapter to be able to retrieve tokens.
75 *
76 * @return TokenStorageInterface
77 */
78 public function getStorage()
79 {
80 return $this->storage;
81 }
82
83 /**
84 * @return string
85 */
86 public function service()
87 {
88 // get class name without backslashes
89 $classname = get_class($this);
90
91 return preg_replace('/^.*\\\\/', '', $classname);
92 }
93 }
94