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

Memory.php

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


 01  <?php
 02  namespace OAuth\Common\Storage;
 03   
 04  use OAuth\Common\Token\TokenInterface;
 05  use OAuth\Common\Storage\Exception\TokenNotFoundException;
 06   
 07  /*
 08   * Stores a token in-memory only (destroyed at end of script execution).
 09   */
 10  class Memory implements TokenStorageInterface
 11  {
 12      /**
 13       * @var object|TokenInterface
 14       */
 15      protected $tokens;
 16   
 17      public function __construct()
 18      {
 19          $this->tokens = array();
 20      }
 21   
 22      /**
 23       * @return \OAuth\Common\Token\TokenInterface
 24       * @throws TokenNotFoundException
 25       */
 26      public function retrieveAccessToken($service)
 27      {
 28          if ($this->hasAccessToken($service))
 29          {
 30              return $this->tokens[$service];
 31          }
 32   
 33          throw new TokenNotFoundException('Token not stored');
 34      }
 35   
 36      /**
 37       * @param \OAuth\Common\Token\TokenInterface $token
 38       */
 39      public function storeAccessToken($service, TokenInterface $token)
 40      {
 41          $this->tokens[$service] = $token;
 42   
 43          // allow chaining
 44          return $this;
 45      }
 46   
 47      /**
 48      * @return bool
 49      */
 50      public function hasAccessToken($service)
 51      {
 52          return isset($this->tokens[$service]) &&
 53                 $this->tokens[$service] instanceOf TokenInterface;
 54      }
 55   
 56      /**
 57       * Delete the user's token. Aka, log out.
 58       */
 59      public function clearToken($service)
 60      {
 61          if (array_key_exists($service, $this->tokens)) {
 62              unset($this->tokens[$service]);
 63          }
 64   
 65          // allow chaining
 66          return $this;
 67      }
 68   
 69      /**
 70       * Delete *ALL* user tokens. Use with care. Most of the time you will likely
 71       * want to use clearToken() instead.
 72       */
 73      public function clearAllTokens()
 74      {
 75          $this->tokens = array();
 76   
 77          // allow chaining
 78          return $this;
 79      }
 80  }
 81