Communicator
in package
Uses
WriterAwareTrait
OAI-PMH Communicator (handles low-level request/response processing).
Tags
Table of Contents
- $baseUrl : string
- URL to harvest from
- $client : Client
- HTTP client
- $outputWriter : WriterInterface
- Writer helper
- $responseProcessor : ResponseProcessorInterface
- Response processor
- __construct() : mixed
- Constructor
- request() : mixed
- Make an OAI-PMH request. Throw an exception if there is an error; return the processed response on success.
- setOutputWriter() : void
- Set an object to accept console output messages.
- getOaiResponse() : string
- Make an OAI-PMH request. Throw an exception if there is an error; return an XML string on success.
- sendRequest() : string
- Perform a single OAI-PMH request.
- write() : void
- Write a string to the console output writer (if set).
- writeLine() : void
- Write a string w/newline to the console output writer (if set).
Properties
$baseUrl
URL to harvest from
protected
string
$baseUrl
$client
HTTP client
protected
Client
$client
$outputWriter
Writer helper
protected
WriterInterface
$outputWriter
= null
$responseProcessor
Response processor
protected
ResponseProcessorInterface
$responseProcessor
Methods
__construct()
Constructor
public
__construct(string $uri, Client $client[, ResponseProcessorInterface $processor = null ]) : mixed
Parameters
- $uri : string
-
Base URI for OAI-PMH server
- $client : Client
-
HTTP client
- $processor : ResponseProcessorInterface = null
-
Response processor (optional)
Return values
mixed —request()
Make an OAI-PMH request. Throw an exception if there is an error; return the processed response on success.
public
request(string $verb[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $verb : string
-
OAI-PMH verb to execute.
- $params : array<string|int, mixed> = []
-
GET parameters for ListRecords method.
Return values
mixed —setOutputWriter()
Set an object to accept console output messages.
public
setOutputWriter(WriterInterface $writer) : void
Parameters
- $writer : WriterInterface
-
Writer object
Return values
void —getOaiResponse()
Make an OAI-PMH request. Throw an exception if there is an error; return an XML string on success.
protected
getOaiResponse(string $verb, array<string|int, mixed> $params) : string
Parameters
- $verb : string
-
OAI-PMH verb to execute.
- $params : array<string|int, mixed>
-
GET parameters for ListRecords method.
Return values
string —sendRequest()
Perform a single OAI-PMH request.
protected
sendRequest(string $verb, array<string|int, mixed> $params) : string
Parameters
- $verb : string
-
OAI-PMH verb to execute.
- $params : array<string|int, mixed>
-
GET parameters for ListRecords method.
Return values
string —write()
Write a string to the console output writer (if set).
protected
write(string $str) : void
Parameters
- $str : string
-
String to write.
Return values
void —writeLine()
Write a string w/newline to the console output writer (if set).
protected
writeLine(string $str) : void
Parameters
- $str : string
-
String to write.