Пример #1
0
 /**
  * Create the Primo Central connector.
  *
  * @return Connector
  */
 protected function createConnector()
 {
     // Load credentials and port number:
     $id = isset($this->primoConfig->General->apiId) ? $this->primoConfig->General->apiId : null;
     $port = isset($this->primoConfig->General->port) ? $this->primoConfig->General->port : 1701;
     // Build HTTP client:
     $client = $this->serviceLocator->get('VuFind\\Http')->createClient();
     $timeout = isset($this->primoConfig->General->timeout) ? $this->primoConfig->General->timeout : 30;
     $client->setOptions(['timeout' => $timeout]);
     $connector = new Connector($id, $this->getInstCode(), $client, $port);
     $connector->setLogger($this->logger);
     if (isset($this->primoConfig->General->highlighting) && $this->primoConfig->General->highlighting) {
         $connector->setHighlighting(true);
     }
     return $connector;
 }
Пример #2
0
 /**
  * Create the Primo Central connector.
  *
  * @return Connector
  */
 protected function createConnector()
 {
     // Get the PermissionHandler
     $permHandler = $this->getPermissionHandler();
     // Load url and credentials:
     if (!isset($this->primoConfig->General->url)) {
         throw new \Exception('Missing url in Primo.ini');
     }
     $instCode = isset($permHandler) ? $permHandler->getInstCode() : null;
     // Build HTTP client:
     $client = $this->serviceLocator->get('VuFind\\Http')->createClient();
     $timeout = isset($this->primoConfig->General->timeout) ? $this->primoConfig->General->timeout : 30;
     $client->setOptions(['timeout' => $timeout]);
     $connector = new Connector($this->primoConfig->General->url, $instCode, $client);
     $connector->setLogger($this->logger);
     if (isset($this->primoConfig->General->highlighting) && $this->primoConfig->General->highlighting) {
         $connector->setHighlighting(true);
     }
     return $connector;
 }