SierraRest
extends AbstractBase
in package
implements
TranslatorAwareInterface, HttpServiceAwareInterface, LoggerAwareInterface, HasSorterInterface
Uses
CacheTrait, LoggerAwareTrait, HttpServiceAwareTrait, TranslatorAwareTrait, HasSorterTrait, RetryTrait, ExplodeSettingTrait
III Sierra REST API driver
Tags
Interfaces, Classes, Traits and Enums
- TranslatorAwareInterface
- Lightweight translator aware marker interface (used as an alternative to \Laminas\I18n\Translator\TranslatorAwareInterface, which requires an excessive number of methods to be implemented).
- HttpServiceAwareInterface
- LoggerAwareInterface
- HasSorterInterface
- Interface SortingInterface
Table of Contents
- HOLDINGS_LOCATION_FIELD = '40'
- Fixed field number for location in holdings records
- ITEM_CHECKIN_DATE_FIELD = '68'
- Fixed field number for item last checkin date (LCHKIN) in item records
- ITEM_ICODE2_FIELD = '60'
- Fixed field number for item code 2 (ICODE2) in item records
- ITEM_ITYPE_FIELD = '61'
- Fixed field number for item type (I TYPE) in item records
- ITEM_OPAC_MESSAGE_FIELD = '108'
- Fixed field number for OPAC message (OPACMSG) in item records
- $allowCancelingAvailableRequests : bool
- Whether to allow canceling of available holds
- $apiBase : string
- API base path
- $apiVersion : int
- Available API version
- $bibCacheTTL : int
- Bib cache entry life time in seconds
- $bibItemsCacheTTL : int
- Life time in seconds for cached items of a bibliographic record
- $cache : StorageInterface
- Cache for storing data temporarily (e.g. patron blocks with the ILS driver)
- $cacheLifetime : int
- Lifetime of cache (in seconds).
- $checkFreezability : bool
- Whether to check hold freezability up front. Not enabled by default since Sierra versions prior to 5.6 return holds slowly if canFreeze is requested.
- $config : array<string|int, mixed>
- Driver configuration
- $dateConverter : Converter
- Date converter
- $defaultBibFields : array<string|int, mixed>
- Default list of bib fields to request from Sierra. This list must include at least 'title' and 'publishYear' needed to compose holds list and fines list. The cached entry will be augmented with any additional fields as needed, within the cache life time (see $bibCacheTTL).
- $defaultItemFields : array<string|int, mixed>
- Default list of item fields to request from Sierra. This list must include at least the fields needed to compose holdings and determine holdability.
- $defaultPickUpLocation : string
- Default pickup location
- $fineTypeMappings : array<string|int, mixed>
- Mappings from fine types to VuFind strings
- $holdAvailableCodes : array<string|int, mixed>
- Status codes indicating that a hold is available for pickup
- $holdInTransitCodes : array<string|int, mixed>
- Status codes indicating that a hold is in transit
- $httpRetryCount : int
- Number of retries in case an API request fails with a retryable error (see $retryableRequestExceptionPatterns below).
- $innReachDb : resource|null
- Sierra INN-Reach Database connection
- $itemCacheTTL : int
- Item cache entry life time in seconds
- $itemHoldBibLevels : array<string|int, mixed>|null
- Bib levels for which item level hold is allowed. If null, negation of titleHoldBibLevels is used instead.
- $itemHoldExcludedItemCodes : array<string|int, mixed>
- Item codes (ICODE2 in Sierra) for which item level hold is not allowed
- $itemHoldExcludedItemTypes : array<string|int, mixed>
- Item types (I TYPE in Sierra) for which item level hold is not allowed
- $itemHoldsEnabled : bool
- Whether item holds are enabled
- $itemStatusMappings : array<string|int, mixed>
- Mappings from item status codes to VuFind strings
- $patronBlockMappings : mixed
- Mappings from patron block codes to VuFind strings
- $retryableRequestExceptionPatterns : array<string|int, mixed>
- Exception message regexp patterns for request errors that can be retried
- $retryOptions : array<string|int, mixed>
- Retry options
- $sessionCache : Container
- Session cache
- $sessionFactory : callable
- Factory function for constructing the SessionContainer.
- $sorter : SorterInterface|null
- Sorter
- $sortItemsByEnumChron : array<string|int, mixed>
- Whether to sort items by enumchron. Default is true.
- $statGroup : int|null
- Statistic group to use e.g. when renewing loans or placing holds
- $titleHoldBibLevels : array<string|int, mixed>
- Bib levels for which title level hold is allowed
- $titleHoldExcludedItemCodes : array<string|int, mixed>
- Item codes (ICODE2 in Sierra) that cause an item to be ignored when $titleHoldRules contains "item".
- $titleHoldExcludedItemTypes : array<string|int, mixed>
- Item types (I TYPE in Sierra) that cause an item to be ignored when $titleHoldRules contains "item".
- $titleHoldRules : array<string|int, mixed>
- Title hold rules
- $titleHoldValidHoldStatuses : array<string|int, mixed>
- Item statuses that count when $titleHoldRules contains "item".
- $translator : TranslatorInterface
- Translator
- $validHoldStatuses : array<string|int, mixed>
- Item statuses that allow placing an hold
- __construct() : mixed
- Constructor
- cancelHolds() : array<string|int, mixed>
- Cancel Holds
- changePassword() : array<string|int, mixed>
- Change Password
- checkRequestIsValid() : bool
- Check if request is valid
- findReserves() : mixed
- Find Reserves
- getAccountBlocks() : mixed
- Check whether the patron has any blocks on their account.
- getConfig() : array<string|int, mixed>
- Public Function which retrieves renew, hold and cancel settings from the driver ini file.
- getDefaultPickUpLocation() : false|string
- Get Default Pick Up Location
- getHolding() : mixed
- Get Holding
- getMyFines() : array<string|int, mixed>
- Get Patron Fines
- getMyHolds() : array<string|int, mixed>
- Get Patron Holds
- getMyProfile() : array<string|int, mixed>
- Get Patron Profile
- getMyTransactionHistory() : array<string|int, mixed>
- Get Patron Transaction History
- getMyTransactions() : array<string|int, mixed>
- Get Patron Transactions
- getNewItems() : array<string|int, mixed>
- Get New Items
- getPickUpLocations() : array<string|int, mixed>
- Get Pick Up Locations
- getPurchaseHistory() : mixed
- Get Purchase History
- getRenewDetails() : string
- Get Renew Details
- getRequestBlocks() : mixed
- Check whether the patron is blocked from placing requests (holds/ILL/SRR).
- getSorter() : SorterInterface
- Get the sorter
- getStatus() : array<string|int, mixed>
- Get Status
- getStatuses() : mixed
- Get Statuses
- getTranslator() : TranslatorInterface
- Get translator object.
- getTranslatorLocale() : string
- Get the locale from the translator.
- init() : void
- Initialize the driver.
- patronLogin() : mixed
- Patron Login
- placeHold() : mixed
- Place Hold
- purgeTransactionHistory() : array<string|int, mixed>
- Purge Patron Transaction History
- renewMyItems() : array<string|int, mixed>
- Renew My Items
- setCacheStorage() : void
- Set a cache storage object.
- setConfig() : void
- Set configuration.
- setSorter() : void
- Set the sorter
- setTranslator() : TranslatorAwareInterface
- Set a translator
- supportsMethod() : bool
- Helper method to determine whether or not a certain method can be called on this driver. Required method for any smart drivers.
- translate() : string
- Translate a string (or string-castable object)
- translateWithPrefix() : string
- Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
- updateHolds() : array<string|int, mixed>
- Update holds
- authenticatePatron() : array<string|int, mixed>|null
- Authenticate a patron
- authenticatePatronV5() : array<string|int, mixed>|null
- Authenticate a patron using the API version 5 endpoints
- authenticatePatronV6() : array<string|int, mixed>|null
- Authenticate a patron using the API version 6 patrons/auth endpoint
- callWithRetry() : mixed
- Call a method and retry the call if an exception is thrown
- checkTitleHoldRules() : bool
- Check if bib matches title hold rules
- createHttpClient() : Client
- Create a HTTP client
- debug() : void
- Log a debug message.
- explodeListSetting() : array<string|int, mixed>
- Explode a comma-delimited setting to an array of trimmed values
- explodeSetting() : array<string|int, mixed>
- Explode a delimited setting to an array
- extractBibId() : int
- Extract a numeric bib ID value from a string that may be prefixed.
- extractCallNumber() : string
- Extract the actual call number from item's call number field
- extractFieldsFromApiData() : string|array<string|int, string>
- Get fields from holdings or bib API response according to the field spec.
- extractId() : string
- Extract an ID from a URL (last number)
- extractTextDomain() : array<string|int, mixed>
- Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
- extractVolume() : string
- Extract volume from item record's varFields
- formatBibId() : string
- If the system is configured to use full prefixed bib IDs, add the prefix and checksum.
- formatCacheKey() : string
- Add instance-specific context to a cache key suffix to ensure that multiple drivers don't accidentally share values in the cache.
- formatErrorMessage() : string
- Format an error message received from Sierra
- getApiUrlFromHierarchy() : string
- Build an API URL from a hierarchy array
- getBackoffDuration() : int
- Get the delay before a try
- getBibCallNumber() : string
- Extract a bib call number from a bib record (if configured to do so).
- getBibRecord() : array<string|int, mixed>|null
- Fetch fields for a bib record from Sierra
- getBibRecords() : array<string|int, mixed>|null
- Fetch fields for bib records from Sierra
- getCachedData() : mixed|null
- Helper function for fetching cached data.
- getCachedRecordData() : array<string|int, mixed>
- Get record data from cache and check that it has the requested fields
- getDebugTranslation() : string
- Build a debug-mode translation
- getDueStatus() : string
- Get due status for a checkout
- getHoldingsData() : array<string|int, mixed>
- Get holdings fields according to configuration
- getInnReachCheckoutTitleInfoFromId() : array<string|int, mixed>
- Gets title information for checked out items from INN-Reach systems
- getInnReachDb() : resource|null
- Establish INN-Reach database connection
- getInnReachHoldTitleInfoFromId() : array<string|int, mixed>
- Gets title information for holds placed in an INN-Reach system
- getItemRecords() : array<string|int, mixed>|null
- Fetch fields for item records from Sierra
- getItemsForBibRecord() : array<string|int, mixed>
- Get all items for a bib record
- getItemStatus() : array<string|int, mixed>
- Get status for an item
- getItemStatusesForBib() : array<string|int, mixed>
- Get Item Statuses
- getItemsWithBibsForTransactions() : array<string|int, mixed>
- Get items and their bibs for an array of transactions
- getLocationName() : string
- Get name for a location code
- getOrderMessages() : array<string|int, mixed>
- Get textual messages for orders
- getPatronAuthorizationCode() : string|bool
- Login and retrieve authorization code for the patron
- getPatronBlocks() : mixed
- Get patron's blocks, if any
- getPatronInformationFromAuthToken() : array<string|int, mixed>
- Get patron information via authentication token when using patron-specific access
- getRecords() : array<string|int, mixed>|null
- Fetch fields for records from Sierra
- holdError() : array<string|int, mixed>
- Hold Error
- isHoldable() : bool
- Determine whether an item is holdable
- isPatronSpecificAccess() : bool
- Check if we re using a patron-specific access token
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- makeRequest() : mixed
- Make Request
- mapStatusCode() : string
- Get the human-readable equivalent of a status code.
- pickUpLocationIsValid() : bool
- Is the selected pickup location valid for the hold?
- pickupLocationSortFunction() : int
- Pickup location sort function
- putCachedData() : void
- Helper function for storing cached data.
- putCachedRecordData() : void
- Insert record data and its field list into the cache
- removeCachedData() : void
- Helper function for removing cached data.
- renewAccessToken() : bool
- Renew the API access token and store it in the cache.
- requestCallback() : mixed
- Callback used by makeRequest
- sanitizeTranslationKey() : string
- Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
- shouldRetry() : bool
- Check if the call needs to be retried
- statusSortFunction() : int
- Status item sort function
- throwAsIlsException() : never
- Rethrow the provided exception as an ILS exception.
- translateLocation() : string
- Translate location name
- translateOpacMessage() : string
- Translate OPAC message
- translateString() : string
- Get translation for a string
- validatePatron() : array<string|int, mixed>|null
- Perform extra validation of retrieved user, if configured to do so. Returns patron data if value, null otherwise.
Constants
HOLDINGS_LOCATION_FIELD
Fixed field number for location in holdings records
public
string
HOLDINGS_LOCATION_FIELD
= '40'
ITEM_CHECKIN_DATE_FIELD
Fixed field number for item last checkin date (LCHKIN) in item records
public
string
ITEM_CHECKIN_DATE_FIELD
= '68'
ITEM_ICODE2_FIELD
Fixed field number for item code 2 (ICODE2) in item records
public
string
ITEM_ICODE2_FIELD
= '60'
ITEM_ITYPE_FIELD
Fixed field number for item type (I TYPE) in item records
public
string
ITEM_ITYPE_FIELD
= '61'
ITEM_OPAC_MESSAGE_FIELD
Fixed field number for OPAC message (OPACMSG) in item records
public
string
ITEM_OPAC_MESSAGE_FIELD
= '108'
Properties
$allowCancelingAvailableRequests
Whether to allow canceling of available holds
protected
bool
$allowCancelingAvailableRequests
= false
$apiBase
API base path
protected
string
$apiBase
= 'v6'
This should correspond to $apiVersion above
$apiVersion
Available API version
protected
int
$apiVersion
= 6
Functionality requiring a specific minimum version:
v5:
- last pickup date for holds v5.1 (technically still v5 but added in a later revision):
- summary holdings information (especially for serials)
Note that API version 3 is deprecated in Sierra 5.1 and will be removed later on (reported March 2020).
$bibCacheTTL
Bib cache entry life time in seconds
protected
int
$bibCacheTTL
= 300
$bibItemsCacheTTL
Life time in seconds for cached items of a bibliographic record
protected
int
$bibItemsCacheTTL
= 2
It is recommended to keep this fairly short to ensure that any recent changes (such as placing a hold) are reflected correctly in holdings.
$cache
Cache for storing data temporarily (e.g. patron blocks with the ILS driver)
protected
StorageInterface
$cache
= null
$cacheLifetime
Lifetime of cache (in seconds).
protected
int
$cacheLifetime
= 30
$checkFreezability
Whether to check hold freezability up front. Not enabled by default since Sierra versions prior to 5.6 return holds slowly if canFreeze is requested.
protected
bool
$checkFreezability
= false
$config
Driver configuration
protected
array<string|int, mixed>
$config
$dateConverter
Date converter
protected
Converter
$dateConverter
$defaultBibFields
Default list of bib fields to request from Sierra. This list must include at least 'title' and 'publishYear' needed to compose holds list and fines list. The cached entry will be augmented with any additional fields as needed, within the cache life time (see $bibCacheTTL).
protected
array<string|int, mixed>
$defaultBibFields
= ['default']
$defaultItemFields
Default list of item fields to request from Sierra. This list must include at least the fields needed to compose holdings and determine holdability.
protected
array<string|int, mixed>
$defaultItemFields
= ['default', 'fixedFields', 'varFields']
$defaultPickUpLocation
Default pickup location
protected
string
$defaultPickUpLocation
= ''
$fineTypeMappings
Mappings from fine types to VuFind strings
protected
array<string|int, mixed>
$fineTypeMappings
= []
$holdAvailableCodes
Status codes indicating that a hold is available for pickup
protected
array<string|int, mixed>
$holdAvailableCodes
= ['b', 'j', 'i']
$holdInTransitCodes
Status codes indicating that a hold is in transit
protected
array<string|int, mixed>
$holdInTransitCodes
= ['t']
$httpRetryCount
Number of retries in case an API request fails with a retryable error (see $retryableRequestExceptionPatterns below).
protected
int
$httpRetryCount
= 2
$innReachDb
Sierra INN-Reach Database connection
protected
resource|null
$innReachDb
= null
$itemCacheTTL
Item cache entry life time in seconds
protected
int
$itemCacheTTL
= 300
$itemHoldBibLevels
Bib levels for which item level hold is allowed. If null, negation of titleHoldBibLevels is used instead.
protected
array<string|int, mixed>|null
$itemHoldBibLevels
= null
$itemHoldExcludedItemCodes
Item codes (ICODE2 in Sierra) for which item level hold is not allowed
protected
array<string|int, mixed>
$itemHoldExcludedItemCodes
= []
$itemHoldExcludedItemTypes
Item types (I TYPE in Sierra) for which item level hold is not allowed
protected
array<string|int, mixed>
$itemHoldExcludedItemTypes
= []
$itemHoldsEnabled
Whether item holds are enabled
protected
bool
$itemHoldsEnabled
$itemStatusMappings
Mappings from item status codes to VuFind strings
protected
array<string|int, mixed>
$itemStatusMappings
= ['!' => 'On Holdshelf', 't' => 'In Transit', 'o' => 'On Reference Desk', 'k' => 'In Repair', 'm' => 'Missing', 'n' => 'Long Overdue', '$' => 'Lost--Library Applied', 'p' => '', 'z' => 'Claims Returned', 's' => 'On Search', 'd' => 'In Process', '-' => 'On Shelf', 'Charged' => 'Charged', 'Ordered' => 'Ordered']
$patronBlockMappings
Mappings from patron block codes to VuFind strings
protected
mixed
$patronBlockMappings
= []
$retryableRequestExceptionPatterns
Exception message regexp patterns for request errors that can be retried
protected
array<string|int, mixed>
$retryableRequestExceptionPatterns
= [
// cURL adapter:
'/Error in cURL request: Empty reply from server/',
// Socket adapter:
'/A valid response status line was not found in the provided string/',
]
$retryOptions
Retry options
protected
array<string|int, mixed>
$retryOptions
= [
'retryCount' => 5,
// number of retries (set to 0 to disable)
'firstBackoff' => 0,
// backoff (delay) before first retry
// (milliseconds)
'subsequentBackoff' => 200,
// backoff (delay) before subsequent retries
// (milliseconds)
'exponentialBackoff' => true,
// whether to use exponential backoff
'maximumBackoff' => 1000,
]
$sessionCache
Session cache
protected
Container
$sessionCache
$sessionFactory
Factory function for constructing the SessionContainer.
protected
callable
$sessionFactory
$sorter
Sorter
protected
SorterInterface|null
$sorter
= null
$sortItemsByEnumChron
Whether to sort items by enumchron. Default is true.
protected
array<string|int, mixed>
$sortItemsByEnumChron
$statGroup
Statistic group to use e.g. when renewing loans or placing holds
protected
int|null
$statGroup
= null
$titleHoldBibLevels
Bib levels for which title level hold is allowed
protected
array<string|int, mixed>
$titleHoldBibLevels
= []
$titleHoldExcludedItemCodes
Item codes (ICODE2 in Sierra) that cause an item to be ignored when $titleHoldRules contains "item".
protected
array<string|int, mixed>
$titleHoldExcludedItemCodes
= []
$titleHoldExcludedItemTypes
Item types (I TYPE in Sierra) that cause an item to be ignored when $titleHoldRules contains "item".
protected
array<string|int, mixed>
$titleHoldExcludedItemTypes
= []
$titleHoldRules
Title hold rules
protected
array<string|int, mixed>
$titleHoldRules
= []
$titleHoldValidHoldStatuses
Item statuses that count when $titleHoldRules contains "item".
protected
array<string|int, mixed>
$titleHoldValidHoldStatuses
= []
$translator
Translator
protected
TranslatorInterface
$translator
= null
$validHoldStatuses
Item statuses that allow placing an hold
protected
array<string|int, mixed>
$validHoldStatuses
= []
Methods
__construct()
Constructor
public
__construct(Converter $dateConverter, callable $sessionFactory) : mixed
Parameters
- $dateConverter : Converter
-
Date converter object
- $sessionFactory : callable
-
Factory function returning SessionContainer object
Return values
mixed —cancelHolds()
Cancel Holds
public
cancelHolds(array<string|int, mixed> $cancelDetails) : array<string|int, mixed>
Attempts to Cancel a hold. The data in $cancelDetails['details'] is taken from holds' cancel_details field.
Parameters
- $cancelDetails : array<string|int, mixed>
-
An array of item and patron data
Return values
array<string|int, mixed> —An array of data on each request including whether or not it was successful and a system message (if available)
changePassword()
Change Password
public
changePassword(array<string|int, mixed> $details) : array<string|int, mixed>
Attempts to change patron password (PIN code)
Parameters
- $details : array<string|int, mixed>
-
An array of patron id and old and new password:
'patron' The patron array from patronLogin 'oldPassword' Old password 'newPassword' New password
Return values
array<string|int, mixed> —An array of data on the request including whether or not it was successful and a system message (if available)
checkRequestIsValid()
Check if request is valid
public
checkRequestIsValid(string $id, array<string|int, mixed> $data, array<string|int, mixed> $patron) : bool
This is responsible for determining if an item is requestable
Parameters
- $id : string
-
The Bib ID
- $data : array<string|int, mixed>
-
An Array of item data
- $patron : array<string|int, mixed>
-
An array of patron data
Return values
bool —True if request is valid, false if not
findReserves()
Find Reserves
public
findReserves(string $course, string $inst, string $dept) : mixed
Obtain information on course reserves.
Parameters
- $course : string
-
ID from getCourses (empty string to match all)
- $inst : string
-
ID from getInstructors (empty string to match all)
- $dept : string
-
ID from getDepartments (empty string to match all)
Tags
Return values
mixed —An array of associative arrays representing reserve items.
getAccountBlocks()
Check whether the patron has any blocks on their account.
public
getAccountBlocks(array<string|int, mixed> $patron) : mixed
Parameters
- $patron : array<string|int, mixed>
-
Patron data from patronLogin().
Return values
mixed —A boolean false if no blocks are in place and an array of block reasons if blocks are in place
getConfig()
Public Function which retrieves renew, hold and cancel settings from the driver ini file.
public
getConfig(string $function[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $function : string
-
The name of the feature to be checked
- $params : array<string|int, mixed> = []
-
Optional feature-specific parameters (array)
Tags
Return values
array<string|int, mixed> —An array with key-value pairs.
getDefaultPickUpLocation()
Get Default Pick Up Location
public
getDefaultPickUpLocation([array<string|int, mixed> $patron = false ][, array<string|int, mixed> $holdDetails = null ]) : false|string
Returns the default pick up location
Parameters
- $patron : array<string|int, mixed> = false
-
Patron information returned by the patronLogin method.
- $holdDetails : array<string|int, mixed> = null
-
Optional array, only passed in when getting a list in the context of placing a hold; contains most of the same values passed to placeHold, minus the patron data. May be used to limit the pickup options or may be ignored.
Tags
Return values
false|string —The default pickup location for the patron or false if the user has to choose.
getHolding()
Get Holding
public
getHolding(string $id[, array<string|int, mixed> $patron = null ][, array<string|int, mixed> $options = [] ]) : mixed
This is responsible for retrieving the holding information of a certain record.
Parameters
- $id : string
-
The record id to retrieve the holdings for
- $patron : array<string|int, mixed> = null
-
Patron data
- $options : array<string|int, mixed> = []
-
Extra options (not currently used)
Tags
Return values
mixed —On success, an associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber, duedate, number, barcode.
getMyFines()
Get Patron Fines
public
getMyFines(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving all fines by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Tags
Return values
array<string|int, mixed> —Array of the patron's fines on success.
getMyHolds()
Get Patron Holds
public
getMyHolds(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving all holds by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Tags
Return values
array<string|int, mixed> —Array of the patron's holds on success.
getMyProfile()
Get Patron Profile
public
getMyProfile(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving the profile for a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array
Tags
Return values
array<string|int, mixed> —Array of the patron's profile data on success.
getMyTransactionHistory()
Get Patron Transaction History
public
getMyTransactionHistory(array<string|int, mixed> $patron, array<string|int, mixed> $params) : array<string|int, mixed>
This is responsible for retrieving all historic transactions (i.e. checked out items) by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
- $params : array<string|int, mixed>
-
Parameters
Tags
Return values
array<string|int, mixed> —Array of the patron's historic transactions on success.
getMyTransactions()
Get Patron Transactions
public
getMyTransactions(array<string|int, mixed> $patron[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
This is responsible for retrieving all transactions (i.e. checked out items) by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
- $params : array<string|int, mixed> = []
-
Parameters
Tags
Return values
array<string|int, mixed> —Array of the patron's transactions on success.
getNewItems()
Get New Items
public
getNewItems(int $page, int $limit, int $daysOld[, int $fundId = null ]) : array<string|int, mixed>
Retrieve the IDs of items recently added to the catalog.
Parameters
- $page : int
-
Page number of results to retrieve (counting starts at 1)
- $limit : int
-
The size of each page of results to retrieve
- $daysOld : int
-
The maximum age of records to retrieve in days (max. 30)
- $fundId : int = null
-
optional fund ID to use for limiting results (use a value returned by getFunds, or exclude for no limit); note that "fund" may be a misnomer - if funds are not an appropriate way to limit your new item results, you can return a different set of values from getFunds. The important thing is that this parameter supports an ID returned by getFunds, whatever that may mean.
Tags
Return values
array<string|int, mixed> —Associative array with 'count' and 'results' keys
getPickUpLocations()
Get Pick Up Locations
public
getPickUpLocations([array<string|int, mixed> $patron = false ][, array<string|int, mixed> $holdDetails = null ]) : array<string|int, mixed>
This is responsible for getting a list of valid library locations for holds / recall retrieval
Parameters
- $patron : array<string|int, mixed> = false
-
Patron information returned by the patronLogin method.
- $holdDetails : array<string|int, mixed> = null
-
Optional array, only passed in when getting a list in the context of placing or editing a hold. When placing a hold, it contains most of the same values passed to placeHold, minus the patron data. When editing a hold it contains all the hold information returned by getMyHolds. May be used to limit the pickup options or may be ignored. The driver must not add new options to the return array based on this data or other areas of VuFind may behave incorrectly.
Tags
Return values
array<string|int, mixed> —An array of associative arrays with locationID and locationDisplay keys
getPurchaseHistory()
Get Purchase History
public
getPurchaseHistory(string $id) : mixed
This is responsible for retrieving the acquisitions history data for the specific record (usually recently received issues of a serial).
Parameters
- $id : string
-
The record id to retrieve the info for
Tags
Return values
mixed —An array with the acquisitions data on success.
getRenewDetails()
Get Renew Details
public
getRenewDetails(array<string|int, mixed> $checkOutDetails) : string
Parameters
- $checkOutDetails : array<string|int, mixed>
-
An array of item data
Return values
string —Data for use in a form field
getRequestBlocks()
Check whether the patron is blocked from placing requests (holds/ILL/SRR).
public
getRequestBlocks(array<string|int, mixed> $patron) : mixed
Parameters
- $patron : array<string|int, mixed>
-
Patron data from patronLogin().
Return values
mixed —A boolean false if no blocks are in place and an array of block reasons if blocks are in place
getSorter()
Get the sorter
public
getSorter() : SorterInterface
Return values
SorterInterface —getStatus()
Get Status
public
getStatus(string $id) : array<string|int, mixed>
This is responsible for retrieving the status information of a certain record.
Parameters
- $id : string
-
The record id to retrieve the holdings for
Return values
array<string|int, mixed> —An associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber.
getStatuses()
Get Statuses
public
getStatuses(array<string|int, mixed> $ids) : mixed
This is responsible for retrieving the status information for a collection of records.
Parameters
- $ids : array<string|int, mixed>
-
The array of record ids to retrieve the status for
Return values
mixed —An array of getStatus() return values on success.
getTranslator()
Get translator object.
public
getTranslator() : TranslatorInterface
Return values
TranslatorInterface —getTranslatorLocale()
Get the locale from the translator.
public
getTranslatorLocale([string $default = 'en' ]) : string
Parameters
- $default : string = 'en'
-
Default to use if translator absent.
Return values
string —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 —patronLogin()
Patron Login
public
patronLogin(string $username, string $password) : mixed
This is responsible for authenticating a patron against the catalog.
Parameters
- $username : string
-
The patron username
- $password : string
-
The patron password
Tags
Return values
mixed —Associative array of patron info on successful login, null on unsuccessful login.
placeHold()
Place Hold
public
placeHold(array<string|int, mixed> $holdDetails) : mixed
Attempts to place a hold or recall on a particular item and returns an array with result details or throws an exception on failure of support classes
Parameters
- $holdDetails : array<string|int, mixed>
-
An array of item and patron data
Tags
Return values
mixed —An array of data on the request including whether or not it was successful and a system message (if available)
purgeTransactionHistory()
Purge Patron Transaction History
public
purgeTransactionHistory(array<string|int, mixed> $patron, array<string|int, mixed>|null $ids) : array<string|int, mixed>
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
- $ids : array<string|int, mixed>|null
-
IDs to purge, or null for all
Tags
Return values
array<string|int, mixed> —Associative array of the results
renewMyItems()
Renew My Items
public
renewMyItems(array<string|int, mixed> $renewDetails) : array<string|int, mixed>
Function for attempting to renew a patron's items. The data in $renewDetails['details'] is determined by getRenewDetails().
Parameters
- $renewDetails : array<string|int, mixed>
-
An array of data required for renewing items including the Patron ID and an array of renewal IDS
Return values
array<string|int, mixed> —An array of renewal information keyed by item ID
setCacheStorage()
Set a cache storage object.
public
setCacheStorage([StorageInterface $cache = null ]) : void
Parameters
- $cache : StorageInterface = null
-
Cache storage interface
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 —setSorter()
Set the sorter
public
setSorter(SorterInterface $sorter) : void
Parameters
- $sorter : SorterInterface
-
Sorter service
Return values
void —setTranslator()
Set a translator
public
setTranslator(TranslatorInterface $translator) : TranslatorAwareInterface
Parameters
- $translator : TranslatorInterface
-
Translator
Return values
TranslatorAwareInterface —supportsMethod()
Helper method to determine whether or not a certain method can be called on this driver. Required method for any smart drivers.
public
supportsMethod(string $method, array<string|int, mixed> $params) : bool
Parameters
- $method : string
-
The name of the called method.
- $params : array<string|int, mixed>
-
Array of passed parameters
Tags
Return values
bool —True if the method can be called with the given parameters, false otherwise.
translate()
Translate a string (or string-castable object)
public
translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —translateWithPrefix()
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
public
translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $prefix : string
-
Translation key prefix
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —updateHolds()
Update holds
public
updateHolds(array<string|int, mixed> $holdsDetails, array<string|int, mixed> $fields, array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for changing the status of hold requests
Parameters
- $holdsDetails : array<string|int, mixed>
-
The details identifying the holds
- $fields : array<string|int, mixed>
-
An associative array of fields to be updated
- $patron : array<string|int, mixed>
-
Patron array
Return values
array<string|int, mixed> —Associative array of the results
authenticatePatron()
Authenticate a patron
protected
authenticatePatron(string $username, string $password) : array<string|int, mixed>|null
Returns patron information on success and null on failure
Parameters
- $username : string
-
Username
- $password : string
-
Password
Return values
array<string|int, mixed>|null —authenticatePatronV5()
Authenticate a patron using the API version 5 endpoints
protected
authenticatePatronV5(string $username, string $password) : array<string|int, mixed>|null
Returns patron information on success and null on failure
Parameters
- $username : string
-
Username
- $password : string
-
Password
Return values
array<string|int, mixed>|null —authenticatePatronV6()
Authenticate a patron using the API version 6 patrons/auth endpoint
protected
authenticatePatronV6(string $username, string $password, string $method) : array<string|int, mixed>|null
Returns patron information on success and null on failure
Parameters
- $username : string
-
Username
- $password : string
-
Password
- $method : string
-
Authentication method
Return values
array<string|int, mixed>|null —callWithRetry()
Call a method and retry the call if an exception is thrown
protected
callWithRetry(callable $callback[, callable|null $statusCallback = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $callback : callable
-
Method to call
- $statusCallback : callable|null = null
-
Status callback called before retry and after a successful retry. The callback gets the attempt number and either an exception if an error occurred or null if the request succeeded after retries.
- $options : array<string|int, mixed> = []
-
Optional options to override defaults in $this->retryOptions. Options can also include a retryableExceptionCallback for a callback that gets the attempt number and exception as parameters and returns true if the call can be retried or false if not.
Return values
mixed —checkTitleHoldRules()
Check if bib matches title hold rules
protected
checkTitleHoldRules(array<string|int, mixed> $bib, array<string|int, mixed> $patron) : bool
Parameters
- $bib : array<string|int, mixed>
-
Bibliographic record fields
- $patron : array<string|int, mixed>
-
An array of patron data
Return values
bool —True if request is valid, false if not
createHttpClient()
Create a HTTP client
protected
createHttpClient(string $url) : Client
Parameters
- $url : string
-
Request URL
Return values
Client —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 —explodeListSetting()
Explode a comma-delimited setting to an array of trimmed values
protected
explodeListSetting(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
Setting value
Return values
array<string|int, mixed> —explodeSetting()
Explode a delimited setting to an array
protected
explodeSetting(string $value[, bool $trim = false ][, string $separator = ':' ]) : array<string|int, mixed>
Parameters
- $value : string
-
Setting value
- $trim : bool = false
-
Whether to trim the values (disabled by default to ensure any valid blank entry does not get trimmed, and to avoid doing extra work on each execution)
- $separator : string = ':'
-
Separator
Return values
array<string|int, mixed> —extractBibId()
Extract a numeric bib ID value from a string that may be prefixed.
protected
extractBibId(string $id) : int
Parameters
- $id : string
-
Bib record id (with or without .b prefix)
Return values
int —extractCallNumber()
Extract the actual call number from item's call number field
protected
extractCallNumber(string $callNumber) : string
Parameters
- $callNumber : string
-
Call number field
Return values
string —extractFieldsFromApiData()
Get fields from holdings or bib API response according to the field spec.
protected
extractFieldsFromApiData(array<string|int, mixed> $response, array<string|int, mixed>|string $fieldSpecs) : string|array<string|int, string>
Parameters
- $response : array<string|int, mixed>
-
API response data
- $fieldSpecs : array<string|int, mixed>|string
-
Array or colon-separated list of field/subfield specifications (3 chars for field code and then subfields, e.g. 866az)
Return values
string|array<string|int, string> —Results as a string if single, array if multiple
extractId()
Extract an ID from a URL (last number)
protected
extractId(string $url) : string
Parameters
- $url : string
-
URL containing the ID
Return values
string —ID
extractTextDomain()
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
protected
extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
Return values
array<string|int, mixed> —extractVolume()
Extract volume from item record's varFields
protected
extractVolume(array<string|int, mixed> $item) : string
Parameters
- $item : array<string|int, mixed>
-
Item record from Sierra
Return values
string —formatBibId()
If the system is configured to use full prefixed bib IDs, add the prefix and checksum.
protected
formatBibId(int $id) : string
Parameters
- $id : int
-
Bib ID that may need to be prefixed.
Return values
string —formatCacheKey()
Add instance-specific context to a cache key suffix to ensure that multiple drivers don't accidentally share values in the cache.
protected
formatCacheKey(string $key) : string
Parameters
- $key : string
-
Cache key suffix
Return values
string —formatErrorMessage()
Format an error message received from Sierra
protected
formatErrorMessage(string $msg) : string
Parameters
- $msg : string
-
An error message string
Return values
string —getApiUrlFromHierarchy()
Build an API URL from a hierarchy array
protected
getApiUrlFromHierarchy(array<string|int, mixed> $hierarchy) : string
Parameters
- $hierarchy : array<string|int, mixed>
-
Hierarchy
Return values
string —getBackoffDuration()
Get the delay before a try
protected
getBackoffDuration(int $attempt, array<string|int, mixed> $options) : int
Parameters
- $attempt : int
-
Attempt number
- $options : array<string|int, mixed>
-
Current options
Return values
int —milliseconds
getBibCallNumber()
Extract a bib call number from a bib record (if configured to do so).
protected
getBibCallNumber(array<string|int, mixed> $bib) : string
Parameters
- $bib : array<string|int, mixed>
-
Bib record
Return values
string —getBibRecord()
Fetch fields for a bib record from Sierra
protected
getBibRecord(string $id[, array<string|int, mixed>|null $fields = null ][, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>|null
Note: This method can return cached data
Parameters
- $id : string
-
Bib record id
- $fields : array<string|int, mixed>|null = null
-
Fields to request or null for defaults
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed>|null —getBibRecords()
Fetch fields for bib records from Sierra
protected
getBibRecords(array<string|int, mixed> $ids[, array<string|int, mixed>|null $fields = null ][, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>|null
Note: This method can return cached data
Parameters
- $ids : array<string|int, mixed>
-
Bib record ids
- $fields : array<string|int, mixed>|null = null
-
Fields to request or null for defaults
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed>|null —getCachedData()
Helper function for fetching cached data.
protected
getCachedData(string $key) : mixed|null
Data is cached for up to $this->cacheLifetime.
Parameters
- $key : string
-
Cache entry key
Return values
mixed|null —Cached entry or null if not cached or expired
getCachedRecordData()
Get record data from cache and check that it has the requested fields
protected
getCachedRecordData(string $cacheId, array<string|int, mixed> $fields) : array<string|int, mixed>
Parameters
- $cacheId : string
-
Cache entry ID
- $fields : array<string|int, mixed>
-
Requested fields
Return values
array<string|int, mixed> —Array with cached data if available, and fields (existing or required)
getDebugTranslation()
Build a debug-mode translation
protected
getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
- $domain : string
-
Text domain
- $str : string
-
String to translate
- $tokens : array<string|int, mixed>
-
Tokens to inject into the translated string
Return values
string —getDueStatus()
Get due status for a checkout
protected
getDueStatus(array<string|int, mixed> $checkout) : string
Parameters
- $checkout : array<string|int, mixed>
-
Checkout
Return values
string —getHoldingsData()
Get holdings fields according to configuration
protected
getHoldingsData(array<string|int, mixed> $holdings) : array<string|int, mixed>
Parameters
- $holdings : array<string|int, mixed>
-
Holdings records
Return values
array<string|int, mixed> —getInnReachCheckoutTitleInfoFromId()
Gets title information for checked out items from INN-Reach systems
protected
getInnReachCheckoutTitleInfoFromId( $checkOutId, $bibId) : array<string|int, mixed>
Parameters
Tags
Return values
array<string|int, mixed> —getInnReachDb()
Establish INN-Reach database connection
protected
getInnReachDb() : resource|null
Return values
resource|null —getInnReachHoldTitleInfoFromId()
Gets title information for holds placed in an INN-Reach system
protected
getInnReachHoldTitleInfoFromId( $holdId, $bibId) : array<string|int, mixed>
Parameters
Tags
Return values
array<string|int, mixed> —getItemRecords()
Fetch fields for item records from Sierra
protected
getItemRecords(array<string|int, mixed> $ids[, array<string|int, mixed>|null $fields = null ][, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>|null
Note: This method can return cached data
Parameters
- $ids : array<string|int, mixed>
-
Item record ids
- $fields : array<string|int, mixed>|null = null
-
Fields to request or null for defaults
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed>|null —getItemsForBibRecord()
Get all items for a bib record
protected
getItemsForBibRecord(string $id[, array<string|int, mixed>|null $fields = null ][, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>
Note: This method can return cached data
Parameters
- $id : string
-
Bib record id
- $fields : array<string|int, mixed>|null = null
-
Fields to request or null for defaults
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed> —getItemStatus()
Get status for an item
protected
getItemStatus(array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
- $item : array<string|int, mixed>
-
Item from Sierra
Return values
array<string|int, mixed> —Status string, possible due date and any notes
getItemStatusesForBib()
Get Item Statuses
protected
getItemStatusesForBib(string $id, bool $checkHoldings[, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>
This is responsible for retrieving the status information of a certain record.
Parameters
- $id : string
-
The record id to retrieve the holdings for
- $checkHoldings : bool
-
Whether to check holdings records
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed> —An associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber.
getItemsWithBibsForTransactions()
Get items and their bibs for an array of transactions
protected
getItemsWithBibsForTransactions(array<string|int, mixed> $transactions, array<string|int, mixed> $patron) : array<string|int, mixed>
Parameters
- $transactions : array<string|int, mixed>
-
Transaction list
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Return values
array<string|int, mixed> —getLocationName()
Get name for a location code
protected
getLocationName(string $locationCode) : string
Parameters
- $locationCode : string
-
Location code
Return values
string —getOrderMessages()
Get textual messages for orders
protected
getOrderMessages(array<string|int, mixed> $orders) : array<string|int, mixed>
Parameters
- $orders : array<string|int, mixed>
-
Orders
Return values
array<string|int, mixed> —getPatronAuthorizationCode()
Login and retrieve authorization code for the patron
protected
getPatronAuthorizationCode(array<string|int, mixed> $patron) : string|bool
Parameters
- $patron : array<string|int, mixed>
-
Patron information
Tags
Return values
string|bool —getPatronBlocks()
Get patron's blocks, if any
protected
getPatronBlocks(array<string|int, mixed> $patron) : mixed
Parameters
- $patron : array<string|int, mixed>
-
Patron
Return values
mixed —A boolean false if no blocks are in place and an array of block reasons if blocks are in place
getPatronInformationFromAuthToken()
Get patron information via authentication token when using patron-specific access
protected
getPatronInformationFromAuthToken(string $username, string $password) : array<string|int, mixed>
Parameters
- $username : string
-
The patron username
- $password : string
-
The patron password
Return values
array<string|int, mixed> —getRecords()
Fetch fields for records from Sierra
protected
getRecords(array<string|int, mixed> $ids, string $type, array<string|int, mixed> $fields, int $ttl[, array<string|int, mixed>|null $patron = null ]) : array<string|int, mixed>|null
Note: This method can return cached data
Parameters
- $ids : array<string|int, mixed>
-
Record ids
- $type : string
-
Record type ('bib' or 'item')
- $fields : array<string|int, mixed>
-
Fields to request
- $ttl : int
-
Cache TTL
- $patron : array<string|int, mixed>|null = null
-
Patron information, if available
Return values
array<string|int, mixed>|null —holdError()
Hold Error
protected
holdError(string $msg[, bool $ilsMsg = true ]) : array<string|int, mixed>
Returns a Hold Error Message
Parameters
- $msg : string
-
An error message string
- $ilsMsg : bool = true
-
Whether the error is an ILS error message (needs formatting and any translations prefix)
Return values
array<string|int, mixed> —An array with a success (boolean) and sysMessage key
isHoldable()
Determine whether an item is holdable
protected
isHoldable(array<string|int, mixed> $item, array<string|int, mixed> $bib) : bool
Parameters
- $item : array<string|int, mixed>
-
Item from Sierra
- $bib : array<string|int, mixed>
-
Bib record from Sierra
Return values
bool —isPatronSpecificAccess()
Check if we re using a patron-specific access token
protected
isPatronSpecificAccess() : bool
Return values
bool —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 —makeRequest()
Make Request
protected
makeRequest(array<string|int, mixed> $hierarchy[, array<string|int, mixed> $params = [] ][, string $method = 'GET' ][, array<string|int, mixed> $patron = false ][, bool $returnStatus = false ][, array<string|int, mixed> $queryParams = [] ]) : mixed
Makes a request to the Sierra REST API
Parameters
- $hierarchy : array<string|int, mixed>
-
Array of values to embed in the URL path of the request
- $params : array<string|int, mixed> = []
-
A keyed array of query data
- $method : string = 'GET'
-
The http request method to use (Default is GET)
- $patron : array<string|int, mixed> = false
-
Patron information, if available
- $returnStatus : bool = false
-
Whether to return HTTP status code and response as a keyed array instead of just the response
- $queryParams : array<string|int, mixed> = []
-
Additional query params that are added to the URL regardless of request type
Tags
Return values
mixed —JSON response decoded to an associative array, an array of HTTP status code and JSON response when $returnStatus is true or null on authentication error when using patron-specific access
mapStatusCode()
Get the human-readable equivalent of a status code.
protected
mapStatusCode(string $code[, string $default = null ]) : string
Parameters
- $code : string
-
Code to map
- $default : string = null
-
Default value if no mapping found
Return values
string —pickUpLocationIsValid()
Is the selected pickup location valid for the hold?
protected
pickUpLocationIsValid(string $pickUpLocation, array<string|int, mixed> $patron, array<string|int, mixed> $holdDetails) : bool
Parameters
- $pickUpLocation : string
-
Selected pickup location
- $patron : array<string|int, mixed>
-
Patron information returned by the patronLogin method.
- $holdDetails : array<string|int, mixed>
-
Details of hold being placed
Return values
bool —pickupLocationSortFunction()
Pickup location sort function
protected
pickupLocationSortFunction(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
-
First pickup location record to compare
- $b : array<string|int, mixed>
-
Second pickup location record to compare
Return values
int —putCachedData()
Helper function for storing cached data.
protected
putCachedData(string $key, mixed $entry[, int $lifetime = null ]) : void
Data is cached for up to $this->cacheLifetime seconds.
Parameters
- $key : string
-
Cache entry key
- $entry : mixed
-
Entry to be cached
- $lifetime : int = null
-
Optional lifetime for the entry in seconds
Return values
void —putCachedRecordData()
Insert record data and its field list into the cache
protected
putCachedRecordData(string $cacheId, array<string|int, mixed> $fields, array<string|int, mixed> $data, int $ttl) : void
Parameters
- $cacheId : string
-
Cache entry ID
- $fields : array<string|int, mixed>
-
Fields contained in the data
- $data : array<string|int, mixed>
-
Data
- $ttl : int
-
Cache entry life time
Return values
void —removeCachedData()
Helper function for removing cached data.
protected
removeCachedData(string $key) : void
Parameters
- $key : string
-
Cache entry key
Return values
void —renewAccessToken()
Renew the API access token and store it in the cache.
protected
renewAccessToken([array<string|int, mixed> $patron = false ]) : bool
Throw an exception if there is an error.
Parameters
- $patron : array<string|int, mixed> = false
-
Patron information, if available
Tags
Return values
bool —True on success, false on patron login failure
requestCallback()
Callback used by makeRequest
protected
requestCallback(array<string|int, mixed> $hierarchy[, array<string|int, mixed> $params = [] ][, string $method = 'GET' ][, array<string|int, mixed> $patron = false ][, bool $returnStatus = false ][, array<string|int, mixed> $queryParams = [] ]) : mixed
Parameters
- $hierarchy : array<string|int, mixed>
-
Array of values to embed in the URL path of the request
- $params : array<string|int, mixed> = []
-
A keyed array of query data
- $method : string = 'GET'
-
The http request method to use (Default is GET)
- $patron : array<string|int, mixed> = false
-
Patron information, if available
- $returnStatus : bool = false
-
Whether to return HTTP status code and response as a keyed array instead of just the response
- $queryParams : array<string|int, mixed> = []
-
Additional query params that are added to the URL regardless of request type
Tags
Return values
mixed —JSON response decoded to an associative array, an array of HTTP status code and JSON response when $returnStatus is true or null on authentication error when using patron-specific access
sanitizeTranslationKey()
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
protected
sanitizeTranslationKey(string $key) : string
Parameters
- $key : string
-
Key to sanitize
Return values
string —Sanitized key
shouldRetry()
Check if the call needs to be retried
protected
shouldRetry(int $attempt, array<string|int, mixed> $options) : bool
Parameters
- $attempt : int
-
Failed attempt number
- $options : array<string|int, mixed>
-
Current options
Return values
bool —statusSortFunction()
Status item sort function
protected
statusSortFunction(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
-
First status record to compare
- $b : array<string|int, mixed>
-
Second status record to compare
Return values
int —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)
Tags
Return values
never —translateLocation()
Translate location name
protected
translateLocation(array<string|int, mixed> $location) : string
Parameters
- $location : array<string|int, mixed>
-
Location
Return values
string —translateOpacMessage()
Translate OPAC message
protected
translateOpacMessage(string $code) : string
Parameters
- $code : string
-
OPAC message code
Return values
string —translateString()
Get translation for a string
protected
translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
- $rawStr : string
-
String to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $domain : string = 'default'
-
Text domain (omit for default)
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
Return values
string —validatePatron()
Perform extra validation of retrieved user, if configured to do so. Returns patron data if value, null otherwise.
protected
validatePatron(array<string|int, mixed>|null $patron, string $validationField, string|null $password) : array<string|int, mixed>|null
Parameters
- $patron : array<string|int, mixed>|null
-
Output of authenticatePatronV5()
- $validationField : string
-
Field to use for validation
- $password : string|null
-
Value to use in validation