AbstractSyndetics
extends AbstractBase
in package
Abstract base for Syndetics content loader plug-ins.
Tags
Table of Contents
- $timeout : int
- HTTP timeout for API calls (in seconds)
- $usePlus : bool
- Use Syndetics plus?
- $useSSL : bool
- Use SSL URLs?
- __construct() : mixed
- Constructor
- loadByIsbn() : array<string|int, mixed>|string
- Load results for a particular API key and ISBN.
- debug() : void
- Log a debug message.
- getHttpClient() : Client
- Get an HTTP client
- getIsbn10() : string
- Attempt to get an ISBN-10; revert to ISBN-13 only when ISBN-10 representation is impossible.
- getIsbnUrl() : string
- Get the Syndetics URL for making a request.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- xmlToDOMDocument() : DOMDocument|bool
- Turn an XML response into a DOMDocument object.
Properties
$timeout
HTTP timeout for API calls (in seconds)
protected
int
$timeout
$usePlus
Use Syndetics plus?
protected
bool
$usePlus
$useSSL
Use SSL URLs?
protected
bool
$useSSL
Methods
__construct()
Constructor
public
__construct([bool $useSSL = false ][, bool $usePlus = false ][, int $timeout = 10 ]) : mixed
Parameters
- $useSSL : bool = false
-
Use SSL URLs?
- $usePlus : bool = false
-
Use Syndetics Plus?
- $timeout : int = 10
-
HTTP timeout for API calls (in seconds)
Return values
mixed —loadByIsbn()
Load results for a particular API key and ISBN.
public
abstract loadByIsbn(string $key, ISBN $isbnObj) : array<string|int, mixed>|string
Parameters
- $key : string
-
API key
- $isbnObj : ISBN
-
ISBN object
Return values
array<string|int, mixed>|string —For array of strings returned, they all are escaped in the template and presented as list. If string is returned it is considered as raw HTML and is NOT escaped.
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 —getHttpClient()
Get an HTTP client
protected
getHttpClient([string $url = null ]) : Client
Parameters
- $url : string = null
-
URL for client to use
Tags
Return values
Client —getIsbn10()
Attempt to get an ISBN-10; revert to ISBN-13 only when ISBN-10 representation is impossible.
protected
getIsbn10(ISBN $isbnObj) : string
Parameters
- $isbnObj : ISBN
-
ISBN object to convert
Return values
string —getIsbnUrl()
Get the Syndetics URL for making a request.
protected
getIsbnUrl(string $isbn, string $id[, string $file = 'index.xml' ][, string $type = 'rw12,h7' ]) : string
Parameters
- $isbn : string
-
ISBN to load
- $id : string
-
Client ID
- $file : string = 'index.xml'
-
File to request
- $type : string = 'rw12,h7'
-
Type parameter
Return values
string —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 —xmlToDOMDocument()
Turn an XML response into a DOMDocument object.
protected
xmlToDOMDocument(string $xml) : DOMDocument|bool
Parameters
- $xml : string
-
XML to load.
Return values
DOMDocument|bool —Document on success, false on failure.