Connector
extends Connector
in package
WorldCat SRU Search Interface
Tags
Table of Contents
- $client : Client
- The HTTP_Request object used for REST transactions
- $host : string
- The host to connect to
- $options : array<string|int, mixed>
- Additional options
- $raw : bool
- Whether to Serialize to a PHP Array or not.
- $sruVersion : string
- The version to specify in the URL
- $wskey : string
- OCLC API key
- __construct() : mixed
- Constructor
- checkForHttpError() : void
- Check for HTTP errors in a response.
- getHoldings() : SimpleXMLElement
- Get holdings information for the specified record.
- getMoreLikeThis() : array<string|int, mixed>
- Get records similar to one record
- getRecord() : string
- Retrieve a specific record.
- scan() : string
- Scan
- search() : string
- Execute a search.
- sruSearch() : array<string|int, mixed>
- Search
- call() : string|SimpleXMLElement
- Submit REST Request
- debug() : void
- Log a debug message.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- process() : string|SimpleXMLElement
- Process an SRU response. Returns either the raw XML string or a SimpleXMLElement based on the contents of the class' raw property.
Properties
$client
The HTTP_Request object used for REST transactions
protected
Client
$client
$host
The host to connect to
protected
string
$host
$options
Additional options
protected
array<string|int, mixed>
$options
$raw
Whether to Serialize to a PHP Array or not.
protected
bool
$raw
= false
$sruVersion
The version to specify in the URL
protected
string
$sruVersion
= '1.1'
$wskey
OCLC API key
protected
string
$wskey
Methods
__construct()
Constructor
public
__construct(string $wsKey, Client $client[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $wsKey : string
-
Web services key
- $client : Client
-
An HTTP client object
- $options : array<string|int, mixed> = []
-
Additional config settings
Return values
mixed —checkForHttpError()
Check for HTTP errors in a response.
public
checkForHttpError(Response $result) : void
Parameters
- $result : Response
-
The response to check.
Tags
Return values
void —getHoldings()
Get holdings information for the specified record.
public
getHoldings(string $id) : SimpleXMLElement
Parameters
- $id : string
-
Record to obtain holdings for.
Tags
Return values
SimpleXMLElement —getMoreLikeThis()
Get records similar to one record
public
getMoreLikeThis(array<string|int, mixed> $record, string $id[, int $max = 5 ]) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
An associative array of the record data
- $id : string
-
The record id
- $max : int = 5
-
The maximum records to return; Default is 5
Return values
array<string|int, mixed> —An array of query results
getRecord()
Retrieve a specific record.
public
getRecord(string $id[, ParamBag $params = null ]) : string
Parameters
- $id : string
-
Record ID to retrieve
- $params : ParamBag = null
-
Parameters
Tags
Return values
string —MARC XML
scan()
Scan
public
scan(string $clause[, int $pos = null ][, int $maxTerms = null ]) : string
Parameters
- $clause : string
-
The CQL clause specifying the start point
- $pos : int = null
-
The position of the start point in the response
- $maxTerms : int = null
-
The maximum number of terms to return
Return values
string —XML response
search()
Execute a search.
public
search(ParamBag $params, int $offset, int $limit) : string
Parameters
- $params : ParamBag
-
Parameters
- $offset : int
-
Search offset
- $limit : int
-
Search limit
Return values
string —sruSearch()
Search
public
sruSearch(string $query[, string $start = 1 ][, string $limit = null ][, string $sortBy = null ][, string $schema = 'marcxml' ][, bool $process = true ]) : array<string|int, mixed>
Parameters
- $query : string
-
The search query
- $start : string = 1
-
The record to start with
- $limit : string = null
-
The amount of records to return
- $sortBy : string = null
-
The value to be used by for sorting
- $schema : string = 'marcxml'
-
Record schema to use in results list
- $process : bool = true
-
Process into array (true) or return raw (false)
Return values
array<string|int, mixed> —An array of query results
call()
Submit REST Request
protected
call([string $method = 'GET' ][, array<string|int, mixed> $params = null ][, bool $process = true ]) : string|SimpleXMLElement
Parameters
- $method : string = 'GET'
-
HTTP Method to use: GET or POST
- $params : array<string|int, mixed> = null
-
An array of parameters for the request
- $process : bool = true
-
Should we convert the MARCXML?
Return values
string|SimpleXMLElement —The response from the XServer
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 —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 —process()
Process an SRU response. Returns either the raw XML string or a SimpleXMLElement based on the contents of the class' raw property.
protected
process(string $response) : string|SimpleXMLElement
Parameters
- $response : string
-
SRU response