RecordWriter
in package
OAI-PMH Record Writer
Tags
Table of Contents
- $harvestedIdLog : string|bool
- Filename for logging harvested IDs (false for none)
- $idPrefix : string
- OAI prefix to strip from ID values
- $idReplace : array<string|int, mixed>
- Replacements for regular expression matches
- $idSearch : array<string|int, mixed>
- Regular expression searches
- $recordFormatter : RecordXmlFormatter
- XML record formatter
- $strategy : RecordWriterStrategyInterface
- Writer strategy
- __construct() : mixed
- Constructor
- getBasePath() : string
- Get base path for writes.
- write() : int
- Save harvested records to disk and return the end date.
- extractID() : string
- Extract the ID from a record object (support method for processRecords()).
- normalizeDate() : int
- Normalize a date to a Unix timestamp.
- writeHarvestedIdsLog() : void
- Write a log file of harvested IDs (if configured to do so).
Properties
$harvestedIdLog
Filename for logging harvested IDs (false for none)
protected
string|bool
$harvestedIdLog
= false
$idPrefix
OAI prefix to strip from ID values
protected
string
$idPrefix
= ''
$idReplace
Replacements for regular expression matches
protected
array<string|int, mixed>
$idReplace
= []
$idSearch
Regular expression searches
protected
array<string|int, mixed>
$idSearch
= []
$recordFormatter
XML record formatter
protected
RecordXmlFormatter
$recordFormatter
$strategy
Writer strategy
protected
RecordWriterStrategyInterface
$strategy
Methods
__construct()
Constructor
public
__construct(RecordWriterStrategyInterface $strategy, RecordXmlFormatter $formatter[, array<string|int, mixed> $settings = [] ]) : mixed
Parameters
- $strategy : RecordWriterStrategyInterface
-
Writing strategy
- $formatter : RecordXmlFormatter
-
XML record formatter
- $settings : array<string|int, mixed> = []
-
Configuration settings
Return values
mixed —getBasePath()
Get base path for writes.
public
getBasePath() : string
Return values
string —write()
Save harvested records to disk and return the end date.
public
write(object $records) : int
Parameters
- $records : object
-
SimpleXML records.
Return values
int —extractID()
Extract the ID from a record object (support method for processRecords()).
protected
extractID(object $record) : string
Parameters
- $record : object
-
SimpleXML record.
Return values
string —The ID value.
normalizeDate()
Normalize a date to a Unix timestamp.
protected
normalizeDate(string $date) : int
Parameters
- $date : string
-
Date (ISO-8601 or YYYY-MM-DD HH:MM:SS)
Return values
int —Unix timestamp (or false if $date invalid)
writeHarvestedIdsLog()
Write a log file of harvested IDs (if configured to do so).
protected
writeHarvestedIdsLog(array<string|int, mixed> $harvestedIds) : void
Parameters
- $harvestedIds : array<string|int, mixed>
-
Harvested IDs