Redi
extends AbstractBase
in package
ReDi Link Resolver Driver
Tags
Table of Contents
- $baseUrl : string
- Base URL for link resolver
- $httpClient : Client
- HTTP client
- $links : array<string|int, mixed>
- Parsed resolver links
- __construct() : mixed
- Constructor
- fetchLinks() : string
- Fetch Links
- getResolverUrl() : string
- Get Resolver Url
- parseLinks() : array<string|int, mixed>
- Parse Links
- supportsMoreOptionsLink() : bool
- This controls whether a "More options" link will be shown below the fetched resolver links eventually linking to the resolver page previously being parsed.
- parseDOI() : array<string|int, mixed>
- Parse the Redi XML response and return array with DOI information.
- parseRediInfo() : string
- Parse Redi additional information elements and return the one identified by the infoToken provided (e.g. "*")
- parseRediOpenURLs() : array<string|int, mixed>
- Parse if the Redi xml snippet contains Redi urls.
- postProcessing() : void
- Hook for post processing of the parsed resolver response (e.g. by removing any double angle quotation mark from each link['title']).
- removeDoubleAngleQuotationMarks() : string
- Helper function to remove hardcoded link-string "»" in Redi response
Properties
$baseUrl
Base URL for link resolver
protected
string
$baseUrl
$httpClient
HTTP client
protected
Client
$httpClient
$links
Parsed resolver links
protected
array<string|int, mixed>
$links
Methods
__construct()
Constructor
public
__construct(string $baseUrl, Client $httpClient) : mixed
Parameters
- $baseUrl : string
-
Base URL for link resolver
- $httpClient : Client
-
HTTP client
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 —Returns resolver specific url
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()
This controls whether a "More options" link will be shown below the fetched resolver links eventually linking to the resolver page previously being parsed.
public
supportsMoreOptionsLink() : bool
This is especially useful for resolver such as the JOP resolver returning XML which would not be of any immediate use for the user.
Return values
bool —parseDOI()
Parse the Redi XML response and return array with DOI information.
protected
parseDOI(DOMDocument $xml) : array<string|int, mixed>
Parameters
- $xml : DOMDocument
-
Loaded xml document
Return values
array<string|int, mixed> —Get back a array with title, URL and service_type
parseRediInfo()
Parse Redi additional information elements and return the one identified by the infoToken provided (e.g. "*")
protected
parseRediInfo(DOMDocument $xml, string $infoToken) : string
Parameters
- $xml : DOMDocument
-
Loaded xml document
- $infoToken : string
-
InfoToken to search for
Return values
string —parseRediOpenURLs()
Parse if the Redi xml snippet contains Redi urls.
protected
parseRediOpenURLs(DOMDocument $xml) : array<string|int, mixed>
Parameters
- $xml : DOMDocument
-
Loaded xml document
Return values
array<string|int, mixed> —Get back Redi direct link to sources containing title, URL and service_type
postProcessing()
Hook for post processing of the parsed resolver response (e.g. by removing any double angle quotation mark from each link['title']).
protected
postProcessing() : void
Return values
void —removeDoubleAngleQuotationMarks()
Helper function to remove hardcoded link-string "»" in Redi response
protected
removeDoubleAngleQuotationMarks(string $string) : string
Parameters
- $string : string
-
String to be manipulated