Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

AbstractService.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.38 KiB


01  <?php
02  namespace OAuth\Common\Service;
03   
04  use OAuth\Common\Consumer\Credentials;
05  use OAuth\Common\Http\Client\ClientInterface;
06  use OAuth\Common\Http\Uri\Uri;
07  use OAuth\Common\Http\Uri\UriInterface;
08  use OAuth\Common\Exception\Exception;
09  use OAuth\Common\Storage\TokenStorageInterface;
10   
11  /**
12   * Abstract OAuth service, version-agnostic
13   */
14  abstract class AbstractService implements ServiceInterface
15  {
16      /** @var \OAuth\Common\Consumer\Credentials */
17      protected $credentials;
18   
19      /** @var \OAuth\Common\Http\Client\ClientInterface */
20      protected $httpClient;
21   
22      /** @var \OAuth\Common\Storage\TokenStorageInterface */
23      protected $storage;
24   
25      /**
26       * @param \OAuth\Common\Consumer\Credentials $credentials
27       * @param \OAuth\Common\Http\Client\ClientInterface $httpClient
28       * @param \OAuth\Common\Storage\TokenStorageInterface $storage
29       */
30      public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage)
31      {
32          $this->credentials = $credentials;
33          $this->httpClient   = $httpClient;
34          $this->storage = $storage;
35      }
36   
37      protected function determineRequestUriFromPath($path, UriInterface $baseApiUri = null)
38      {
39          if( $path instanceof UriInterface ) {
40              $uri = $path;
41          } elseif( stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0 ) {
42              $uri = new Uri($path);
43          } else {
44              if( null === $baseApiUri ) {
45                  throw new Exception('An absolute URI must be passed to ServiceInterface::request as no baseApiUri is set.');
46              }
47   
48              $uri = clone $baseApiUri;
49              if( false !== strpos($path, '?') ) {
50                  $parts = explode('?', $path, 2);
51                  $path = $parts[0];
52                  $query = $parts[1];
53                  $uri->setQuery($query);
54              }
55   
56              if( $path[0] === '/' ) {
57                  $path = substr($path, 1);
58              }
59   
60              $uri->setPath($uri->getPath() . $path);
61          }
62   
63          return $uri;
64      }
65   
66      /**
67      * Accessor to the storage adapter to be able to retrieve tokens
68      *
69      */
70      public function getStorage() {
71          return $this->storage;
72      }
73   
74      /**
75       * @return string
76       */
77      public function service() 
78      {
79          // get class name without backslashes
80          $classname = get_class($this);
81          return preg_replace('/^.*\\\\/', '', $classname);
82      }
83  }
84