Ejemplo n.º 1
0
 /**
  * @return Token
  *
  * @throws Github\LogicException  when token has not been obtained yet
  */
 public function getToken()
 {
     $token = $this->storage->get('auth.token');
     if ($token === NULL) {
         throw new Github\LogicException('Token has not been obtained yet.');
     }
     return $token;
 }
Ejemplo n.º 2
0
 /**
  * @return Token
  *
  * @throws Github\LogicException  when token has not been obtained yet
  */
 public function getToken()
 {
     $token = $this->storage->get('auth.token');
     if ($token === NULL) {
         throw new Github\LogicException('Token has not been obtained yet.');
     } elseif ($token instanceof Token) {
         /** @deprecated */
         $token = $token->toArray();
         $this->storage->set('auth.token', $token);
     }
     return Token::createFromArray($token);
 }