Jop
extends AbstractBase
in package
JOP Link Resolver Driver
Tags
Table of Contents
- $baseUrl : string
- Base URL for link resolver
- $httpClient : Client
- HTTP client
- $userIpReader : UserIpReader
- User IP address reader
- $xpathTitleSelector : string
- As the JOP resolver provides also generic labels 'Article', 'Journal' etc. in element AccessLevel this label can be used as title for resolver results by setting this variable to 'AccessLevel'
- __construct() : mixed
- Constructor
- fetchLinks() : string
- Fetch Links
- getResolverUrl() : string
- Get Resolver Url
- parseLinks() : array<string|int, mixed>
- Parse Links
- supportsMoreOptionsLink() : bool
- Allows for resolver driver specific enabling/disabling of the more options link which will link directly to the resolver URL. This should return false if the resolver returns data in XML or any other human unfriendly response.
- downgradeOpenUrl() : string
- Downgrade an OpenURL from v1.0 to v0.1 for compatibility with JOP.
- getElectronicResults() : void
- Extract electronic results from the JOP response and inject them into the $records array.
- getPrintResults() : void
- Extract print results from the JOP response and inject them into the $records array.
Properties
$baseUrl
Base URL for link resolver
protected
string
$baseUrl
$httpClient
HTTP client
protected
Client
$httpClient
$userIpReader
User IP address reader
protected
UserIpReader
$userIpReader
$xpathTitleSelector
As the JOP resolver provides also generic labels 'Article', 'Journal' etc. in element AccessLevel this label can be used as title for resolver results by setting this variable to 'AccessLevel'
protected
string
$xpathTitleSelector
= 'Title'
Methods
__construct()
Constructor
public
__construct(string $baseUrl, Client $httpClient, UserIpReader $userIpReader) : mixed
Parameters
- $baseUrl : string
-
Base URL for link resolver
- $httpClient : Client
-
HTTP client
- $userIpReader : UserIpReader
-
User IP address reader
Return values
mixed —fetchLinks()
Fetch Links
public
fetchLinks(string $openURL) : string
Fetches a set of links corresponding to an OpenURL
Parameters
- $openURL : string
-
openURL (url-encoded)
Return values
string —raw XML returned by resolver
getResolverUrl()
Get Resolver Url
public
getResolverUrl(string $openURL) : string
Transform the OpenURL as needed to get a working link to the resolver.
Parameters
- $openURL : string
-
openURL (url-encoded)
Return values
string —Link
parseLinks()
Parse Links
public
parseLinks(string $xmlstr) : array<string|int, mixed>
Parses an XML file returned by a link resolver and converts it to a standardised format for display
Parameters
- $xmlstr : string
-
Raw XML returned by resolver
Return values
array<string|int, mixed> —Array of values
supportsMoreOptionsLink()
Allows for resolver driver specific enabling/disabling of the more options link which will link directly to the resolver URL. This should return false if the resolver returns data in XML or any other human unfriendly response.
public
supportsMoreOptionsLink() : bool
Return values
bool —downgradeOpenUrl()
Downgrade an OpenURL from v1.0 to v0.1 for compatibility with JOP.
protected
downgradeOpenUrl(array<string|int, mixed> $parsed) : string
Parameters
- $parsed : array<string|int, mixed>
-
Array of parameters parsed from the OpenURL.
Return values
string —JOP-compatible v0.1 OpenURL
getElectronicResults()
Extract electronic results from the JOP response and inject them into the $records array.
protected
getElectronicResults(string $state, string $coverage, array<string|int, mixed> &$records, DOMXpath $xpath) : void
Parameters
- $state : string
-
The state attribute value to extract
- $coverage : string
-
The coverage string to associate with the state
- $records : array<string|int, mixed>
-
The array of results to update
- $xpath : DOMXpath
-
The XPath object containing parsed XML
Return values
void —getPrintResults()
Extract print results from the JOP response and inject them into the $records array.
protected
getPrintResults(string $state, string $coverage, array<string|int, mixed> &$records, DOMXpath $xpath) : void
Parameters
- $state : string
-
The state attribute value to extract
- $coverage : string
-
The coverage string to associate with the state
- $records : array<string|int, mixed>
-
The array of results to update
- $xpath : DOMXpath
-
The XPath object containing parsed XML