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

EveOnline.php

Zuletzt modifiziert: 09.10.2024, 12:59 - Dateigröße: 2.78 KiB


 001  <?php
 002  /**
 003   * Contains EveOnline class.
 004   * PHP version 5.4
 005   * @copyright 2014 Michael Cummings
 006   * @author    Michael Cummings <mgcummings@yahoo.com>
 007   */
 008  namespace OAuth\OAuth2\Service;
 009   
 010  use OAuth\Common\Consumer\CredentialsInterface;
 011  use OAuth\Common\Http\Client\ClientInterface;
 012  use OAuth\Common\Http\Exception\TokenResponseException;
 013  use OAuth\Common\Http\Uri\Uri;
 014  use OAuth\Common\Http\Uri\UriInterface;
 015  use OAuth\Common\Storage\TokenStorageInterface;
 016  use OAuth\Common\Token\TokenInterface;
 017  use OAuth\OAuth2\Token\StdOAuth2Token;
 018   
 019  /**
 020   * Class EveOnline
 021   */
 022  class EveOnline extends AbstractService
 023  {
 024      public function __construct(
 025          CredentialsInterface $credentials,
 026          ClientInterface $httpClient,
 027          TokenStorageInterface $storage,
 028          $scopes = array(),
 029          UriInterface $baseApiUri = null
 030      ) {
 031          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
 032   
 033          if (null === $baseApiUri) {
 034              $this->baseApiUri = new Uri('https://login.eveonline.com');
 035          }
 036      }
 037   
 038      /**
 039       * Returns the authorization API endpoint.
 040       * @return UriInterface
 041       */
 042      public function getAuthorizationEndpoint()
 043      {
 044          return new Uri($this->baseApiUri . '/oauth/authorize');
 045      }
 046   
 047      /**
 048       * Returns the access token API endpoint.
 049       * @return UriInterface
 050       */
 051      public function getAccessTokenEndpoint()
 052      {
 053          return new Uri($this->baseApiUri . '/oauth/token');
 054      }
 055   
 056      /**
 057       * Parses the access token response and returns a TokenInterface.
 058       *
 059       * @param string $responseBody
 060       *
 061       * @return TokenInterface
 062       * @throws TokenResponseException
 063       */
 064      protected function parseAccessTokenResponse($responseBody)
 065      {
 066          $data = json_decode($responseBody, true);
 067   
 068          if (null === $data || !is_array($data)) {
 069              throw new TokenResponseException('Unable to parse response.');
 070          } elseif (isset($data['error_description'])) {
 071              throw new TokenResponseException('Error in retrieving token: "' . $data['error_description'] . '"');
 072          } elseif (isset($data['error'])) {
 073              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
 074          }
 075   
 076          $token = new StdOAuth2Token();
 077          $token->setAccessToken($data['access_token']);
 078          $token->setLifeTime($data['expires_in']);
 079   
 080          if (isset($data['refresh_token'])) {
 081              $token->setRefreshToken($data['refresh_token']);
 082              unset($data['refresh_token']);
 083          }
 084   
 085          unset($data['access_token']);
 086          unset($data['expires_in']);
 087   
 088          $token->setExtraParams($data);
 089   
 090          return $token;
 091      }
 092   
 093      /**
 094       * {@inheritdoc}
 095       */
 096      protected function getAuthorizationMethod()
 097      {
 098          return static::AUTHORIZATION_METHOD_HEADER_BEARER;
 099      }
 100  }
 101