Relais
in package
implements
LoggerAwareInterface
Uses
LoggerAwareTrait
Relais connection class.
Tags
Interfaces, Classes, Traits and Enums
- LoggerAwareInterface
Table of Contents
- $client : Client
- HTTP client
- $config : Config
- Relais configuration
- __construct() : mixed
- Constructor
- authenticatePatron() : mixed
- Authenticate a patron
- placeRequest() : string
- Place a request
- search() : string
- Perform a search
- debug() : void
- Log a debug message.
- getDefaultData() : array<string|int, mixed>
- Get default data to send to API.
- getOclcRequestData() : array<string|int, mixed>
- Format the parameters needed to look up an OCLC number in the API.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- request() : string
- Make an API request
Properties
$client
HTTP client
protected
Client
$client
$config
Relais configuration
protected
Config
$config
Methods
__construct()
Constructor
public
__construct(Client $client, Config $config) : mixed
Parameters
- $client : Client
-
HTTP client
- $config : Config
-
Relais configuration
Return values
mixed —authenticatePatron()
Authenticate a patron
public
authenticatePatron([string $patron = null ][, bool $returnFullObject = false ]) : mixed
Parameters
- $patron : string = null
-
Patron ID (null to use default from config)
- $returnFullObject : bool = false
-
True to return the full API response object; false to return only the authorization ID.
Tags
Return values
mixed —placeRequest()
Place a request
public
placeRequest(string $oclc, string $auth[, string $patron = null ]) : string
Parameters
- $oclc : string
-
OCLC number to look up
- $auth : string
-
Authentication ID from authenticatePatron()
- $patron : string = null
-
Patron ID (null to use default from config)
Tags
Return values
string —search()
Perform a search
public
search(string $oclc, string $auth[, string $patron = null ]) : string
Parameters
- $oclc : string
-
OCLC number to look up
- $auth : string
-
Authentication ID from authenticatePatron()
- $patron : string = null
-
Patron ID (null to use default from config)
Tags
Return values
string —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 —getDefaultData()
Get default data to send to API.
protected
getDefaultData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOclcRequestData()
Format the parameters needed to look up an OCLC number in the API.
protected
getOclcRequestData(string $oclc, string|null $patron) : array<string|int, mixed>
Parameters
- $oclc : string
-
OCLC number to look up
- $patron : string|null
-
Patron ID (null to use default from config)
Return values
array<string|int, mixed> —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 —request()
Make an API request
protected
request(string $uri, array<string|int, mixed> $data) : string
Parameters
- $uri : string
-
Endpoint to request from
- $data : array<string|int, mixed>
-
Data to send with request