AbstractMultiDriver
extends AbstractBase
in package
implements
LoggerAwareInterface
Uses
LoggerAwareTrait
Abstract Multi Driver.
This abstract driver defines some common methods for ILS drivers that use multiple other ILS drivers.
Tags
Interfaces, Classes, Traits and Enums
- LoggerAwareInterface
Table of Contents
- $config : array<string|int, mixed>
- Driver configuration
- $configLoader : PluginManager
- Configuration loader
- $driverCache : array<string|int, object>
- The array of cached drivers
- $driverManager : PluginManager
- ILS driver manager
- $drivers : array<string|int, string>
- The array of configured driver names.
- $driversConfigPath : string
- The path to the driver configurations relative to the config path
- __construct() : mixed
- Constructor
- init() : void
- Initialize the driver.
- setConfig() : void
- Set configuration.
- createDriver() : mixed
- Create a driver with the given name.
- debug() : void
- Log a debug message.
- driverSupportsMethod() : bool
- Check whether the given driver supports the given method
- getDriver() : mixed
- Find the correct driver for the correct configuration file with the given name and cache an initialized copy of it.
- getDriverConfig() : array<string|int, mixed>
- Get configuration for the ILS driver. We will load an .ini file named after the driver class and number if it exists; otherwise we will return an empty array.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- throwAsIlsException() : never
- Rethrow the provided exception as an ILS exception.
Properties
$config
Driver configuration
protected
array<string|int, mixed>
$config
= []
$configLoader
Configuration loader
protected
PluginManager
$configLoader
$driverCache
The array of cached drivers
protected
array<string|int, object>
$driverCache
= []
$driverManager
ILS driver manager
protected
PluginManager
$driverManager
$drivers
The array of configured driver names.
protected
array<string|int, string>
$drivers
= []
$driversConfigPath
The path to the driver configurations relative to the config path
protected
string
$driversConfigPath
Methods
__construct()
Constructor
public
__construct(PluginManager $configLoader, PluginManager $dm) : mixed
Parameters
- $configLoader : PluginManager
-
Configuration loader
- $dm : PluginManager
-
ILS driver manager
Return values
mixed —init()
Initialize the driver.
public
init() : void
Validate configuration and perform all resource-intensive tasks needed to make the driver active.
Tags
Return values
void —setConfig()
Set configuration.
public
setConfig(array<string|int, mixed> $config) : void
Set the configuration for the driver.
Parameters
- $config : array<string|int, mixed>
-
Configuration array (usually loaded from a VuFind .ini file whose name corresponds with the driver class name).
Return values
void —createDriver()
Create a driver with the given name.
protected
createDriver(string $name) : mixed
Parameters
- $name : string
-
Name of the driver.
Return values
mixed —On success a driver object, otherwise null.
debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —driverSupportsMethod()
Check whether the given driver supports the given method
protected
driverSupportsMethod(object $driver, string $method[, array<string|int, mixed> $params = null ]) : bool
Parameters
- $driver : object
-
ILS Driver
- $method : string
-
Method name
- $params : array<string|int, mixed> = null
-
Array of passed parameters
Return values
bool —getDriver()
Find the correct driver for the correct configuration file with the given name and cache an initialized copy of it.
protected
getDriver(string $name) : mixed
Parameters
- $name : string
-
The name of the driver to get.
Return values
mixed —On success a driver object, otherwise null.
getDriverConfig()
Get configuration for the ILS driver. We will load an .ini file named after the driver class and number if it exists; otherwise we will return an empty array.
protected
getDriverConfig(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
The $name to use for determining the configuration file
Return values
array<string|int, mixed> —The configuration of the driver
log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —throwAsIlsException()
Rethrow the provided exception as an ILS exception.
protected
throwAsIlsException(Throwable $exception[, string $msg = null ]) : never
Parameters
- $exception : Throwable
-
Exception to rethrow
- $msg : string = null
-
Override exception message (optional)