/**
  * @inheritdoc
  * @throws \Exception
  */
 public function checkTokenExpired()
 {
     $token = $this->client->getToken();
     if (!$token) {
         throw new \Exception('Token is not set');
     }
     return $token->getExpiresAt() < time();
 }
Beispiel #2
0
 /**
  * Prepare Authentication headers required by Imgur and/or Mashape
  *
  * @return array
  */
 protected function prepareAuthenticationHeaders()
 {
     $headers = [];
     $headers['Authorization'] = 'Client-ID ' . $this->client->getClientId();
     if ($this->client->getToken() && $this->client->getToken()->getAccessToken()) {
         $headers['Authorization'] = 'Bearer ' . $this->client->getToken()->getAccessToken();
     }
     if ($this->client->getMashapeKey()) {
         $headers['X-Mashape-Key'] = $this->client->getMashapeKey();
     }
     return $headers;
 }