Skip to content
Snippets Groups Projects
Commit 3efe922f authored by Demian Katz's avatar Demian Katz Committed by GitHub
Browse files

KohaILSDI adjustments (#848)

- Use date converter from factory instead of date converter from init().
- Use traits to reduce redundant code.
parent 7f5f6ecb
No related merge requests found
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
namespace VuFind\ILS\Driver; namespace VuFind\ILS\Driver;
use PDO, PDOException; use PDO, PDOException;
use VuFind\Exception\ILS as ILSException; use VuFind\Exception\ILS as ILSException;
use VuFindHttp\HttpServiceInterface;
use Zend\Log\LoggerInterface; use Zend\Log\LoggerInterface;
use VuFind\Exception\Date as DateException; use VuFind\Exception\Date as DateException;
...@@ -48,6 +47,9 @@ use VuFind\Exception\Date as DateException; ...@@ -48,6 +47,9 @@ use VuFind\Exception\Date as DateException;
class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements
\VuFindHttp\HttpServiceAwareInterface, \Zend\Log\LoggerAwareInterface \VuFindHttp\HttpServiceAwareInterface, \Zend\Log\LoggerAwareInterface
{ {
use \VuFindHttp\HttpServiceAwareTrait;
use \VuFind\Log\LoggerAwareTrait;
/** /**
* Web services host * Web services host
* *
...@@ -107,57 +109,22 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements ...@@ -107,57 +109,22 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements
protected $logger = false; protected $logger = false;
/** /**
* Set the logger * Date converter object
*
* @param LoggerInterface $logger Logger to use.
*
* @return void
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* Show a debug message.
*
* @param string $msg Debug message.
*
* @return void
*/
protected function debug($msg)
{
if ($this->logger) {
$this->logger->debug($msg);
}
}
/**
* HTTP service
* *
* @var \VuFindHttp\HttpServiceInterface * @var \VuFind\Date\Converter
*/ */
protected $httpService = null; protected $dateConverter;
/** /**
* Set the HTTP service to be used for HTTP requests. * Constructor
*
* @param HttpServiceInterface $service HTTP service
* *
* @return void * @param \VuFind\Date\Converter $dateConverter Date converter object
*/ */
public function setHttpService(HttpServiceInterface $service) public function __construct(\VuFind\Date\Converter $dateConverter)
{ {
$this->httpService = $service; $this->dateConverter = $dateConverter;
} }
/**
* Date converter object
*
* @var \VuFind\Date\Converter
*/
protected $dateConverter;
/** /**
* Initialize the driver. * Initialize the driver.
* *
...@@ -195,9 +162,6 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements ...@@ -195,9 +162,6 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements
= isset($this->config['Other']['availableLocations']) = isset($this->config['Other']['availableLocations'])
? $this->config['Other']['availableLocations'] : []; ? $this->config['Other']['availableLocations'] : [];
// Create a dateConverter
$this->dateConverter = new \VuFind\Date\Converter;
$this->debug("Config Summary:"); $this->debug("Config Summary:");
$this->debug("DB Host: " . $this->host); $this->debug("DB Host: " . $this->host);
$this->debug("ILS URL: " . $this->ilsBaseUrl); $this->debug("ILS URL: " . $this->ilsBaseUrl);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment