コード例 #1
0
ファイル: Backend.php プロジェクト: steenlibrary/vufind
 /**
  * Obtain data from the INFO method
  *
  * @param string $sessionToken Session token (optional)
  *
  * @return array
  */
 public function getInfo($sessionToken = null)
 {
     $authenticationToken = $this->getAuthenticationToken();
     if (null == $sessionToken) {
         $sessionToken = $this->getSessionToken();
     }
     try {
         $response = $this->client->info($authenticationToken, $sessionToken);
     } catch (\EbscoEdsApiException $e) {
         if ($e->getApiErrorCode() == 104) {
             try {
                 $authenticationToken = $this->getAuthenticationToken(true);
                 $response = $this->client->info($authenticationToken, $sessionToken);
             } catch (Exception $e) {
                 throw new BackendException($e->getMessage(), $e->getCode(), $e);
             }
         } else {
             $response = [];
         }
     }
     return $response;
 }
コード例 #2
0
 /**
  * Create the EDS connector.
  *
  * @return Connector
  */
 protected function createConnector()
 {
     $options = [];
     $id = 'EDS';
     $key = 'EDS';
     // Build HTTP client:
     $client = $this->serviceLocator->get('VuFind\\Http')->createClient();
     $timeout = isset($this->edsConfig->General->timeout) ? $this->edsConfig->General->timeout : 30;
     $client->setOptions(['timeout' => $timeout]);
     $connector = new Connector($id, $key, $options, $client);
     $connector->setLogger($this->logger);
     return $connector;
 }