Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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:59 - Dateigröße: 2.54 KiB


001  <?php
002   
003  namespace OAuth\Common\Service;
004   
005  use OAuth\Common\Consumer\CredentialsInterface;
006  use OAuth\Common\Http\Client\ClientInterface;
007  use OAuth\Common\Http\Uri\Uri;
008  use OAuth\Common\Http\Uri\UriInterface;
009  use OAuth\Common\Exception\Exception;
010  use OAuth\Common\Storage\TokenStorageInterface;
011   
012  /**
013   * Abstract OAuth service, version-agnostic
014   */
015  abstract class AbstractService implements ServiceInterface
016  {
017      /** @var Credentials */
018      protected $credentials;
019   
020      /** @var ClientInterface */
021      protected $httpClient;
022   
023      /** @var TokenStorageInterface */
024      protected $storage;
025   
026      /**
027       * @param CredentialsInterface  $credentials
028       * @param ClientInterface       $httpClient
029       * @param TokenStorageInterface $storage
030       */
031      public function __construct(
032          CredentialsInterface $credentials,
033          ClientInterface $httpClient,
034          TokenStorageInterface $storage
035      ) {
036          $this->credentials = $credentials;
037          $this->httpClient = $httpClient;
038          $this->storage = $storage;
039      }
040   
041      /**
042       * @param UriInterface|string $path
043       * @param UriInterface        $baseApiUri
044       *
045       * @return UriInterface
046       *
047       * @throws Exception
048       */
049      protected function determineRequestUriFromPath($path, UriInterface $baseApiUri = null)
050      {
051          if ($path instanceof UriInterface) {
052              $uri = $path;
053          } elseif (stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0) {
054              $uri = new Uri($path);
055          } else {
056              if (null === $baseApiUri) {
057                  throw new Exception(
058                      'An absolute URI must be passed to ServiceInterface::request as no baseApiUri is set.'
059                  );
060              }
061   
062              $uri = clone $baseApiUri;
063              if (false !== strpos($path, '?')) {
064                  $parts = explode('?', $path, 2);
065                  $path = $parts[0];
066                  $query = $parts[1];
067                  $uri->setQuery($query);
068              }
069   
070              if ($path[0] === '/') {
071                  $path = substr($path, 1);
072              }
073   
074              $uri->setPath($uri->getPath() . $path);
075          }
076   
077          return $uri;
078      }
079   
080      /**
081       * Accessor to the storage adapter to be able to retrieve tokens
082       *
083       * @return TokenStorageInterface
084       */
085      public function getStorage()
086      {
087          return $this->storage;
088      }
089   
090      /**
091       * @return string
092       */
093      public function service()
094      {
095          // get class name without backslashes
096          $classname = get_class($this);
097   
098          return preg_replace('/^.*\\\\/', '', $classname);
099      }
100  }
101