Exemplo n.º 1
0
 /**
  * Create the Summon connector.
  * Detects clients relevant for target switching by IP and hostname
  *
  * @return Connector
  */
 protected function createConnector()
 {
     // Load credentials:
     $id = isset($this->config->Summon->apiId) ? $this->config->Summon->apiId : null;
     $key = isset($this->config->Summon->apiKey) ? $this->config->Summon->apiKey : null;
     $overrideCredentials = $this->getOverrideApiCredentialsFromProxy();
     if ($overrideCredentials !== false) {
         if (isset($overrideCredentials['apiId']) && !empty($overrideCredentials['apiId'])) {
             $id = $overrideCredentials['apiId'];
         }
         if (isset($overrideCredentials['apiKey']) && !empty($overrideCredentials['apiKey'])) {
             $key = $overrideCredentials['apiKey'];
         }
     }
     /** @var HttpClient $client */
     $client = $this->serviceLocator->get('VuFind\\Http')->createClient();
     $timeout = isset($this->summonConfig->General->timeout) ? $this->summonConfig->General->timeout : 30;
     $client->setOptions(array('timeout' => $timeout));
     $connector = new Connector($id, $key, array(), $client);
     $connector->setLogger($this->logger);
     return $connector;
 }
Exemplo n.º 2
0
 /**
  * Create the Summon connector.
  *
  * @return Connector
  */
 protected function createConnector()
 {
     // Load credentials:
     $id = isset($this->config->Summon->apiId) ? $this->config->Summon->apiId : null;
     $key = isset($this->config->Summon->apiKey) ? $this->config->Summon->apiKey : null;
     // Build HTTP client:
     $client = $this->serviceLocator->get('VuFind\\Http')->createClient();
     $timeout = isset($this->summonConfig->General->timeout) ? $this->summonConfig->General->timeout : 30;
     $client->setOptions(['timeout' => $timeout]);
     $options = ['authedUser' => $this->isAuthed()];
     $connector = new Connector($id, $key, $options, $client);
     $connector->setLogger($this->logger);
     return $connector;
 }