CombinedRecordWriterStrategy
extends AbstractRecordWriterStrategy
in package
Strategy for writing records to disk as a combined file.
Tags
Table of Contents
- $basePath : string
- Directory for storing harvested files
- $deletedIds : array<string|int, mixed>
- Collection of deleted IDs.
- $firstHarvestedId : string
- The ID of the first successfully harvested record.
- $innerXML : array<string|int, mixed>
- Collection of XML to include inside final output tag.
- $wrappingTag : string
- The wrapping XML tag to be used if combinedRecords is set to true
- __construct() : mixed
- Constructor
- addDeletedRecord() : void
- Add the ID of a deleted record.
- addRecord() : void
- Add a non-deleted record.
- beginWrite() : void
- Called before the writing process begins.
- endWrite() : void
- Close out the writing process.
- getBasePath() : string
- Get base path for writes.
- getCombinedXML() : string
- Support method for building combined XML document.
- getFilename() : string
- Get the filename for a specific record ID.
- saveDeletedRecords() : void
- Create a tracking file to record the deletion of a record.
- saveFile() : void
- Save a record to disk.
Properties
$basePath
Directory for storing harvested files
protected
string
$basePath
$deletedIds
Collection of deleted IDs.
protected
array<string|int, mixed>
$deletedIds
= []
$firstHarvestedId
The ID of the first successfully harvested record.
protected
string
$firstHarvestedId
= false
$innerXML
Collection of XML to include inside final output tag.
protected
array<string|int, mixed>
$innerXML
= ''
$wrappingTag
The wrapping XML tag to be used if combinedRecords is set to true
protected
string
$wrappingTag
= '<collection>'
Methods
__construct()
Constructor
public
__construct(string $basePath[, string $tag = null ]) : mixed
Parameters
- $basePath : string
-
Target directory for harvested files
- $tag : string = null
-
Wrapping tag to contain collection (null for default of
)
Return values
mixed —addDeletedRecord()
Add the ID of a deleted record.
public
addDeletedRecord(string $id) : void
Parameters
- $id : string
-
ID
Return values
void —addRecord()
Add a non-deleted record.
public
addRecord(string $id, string $record) : void
Parameters
- $id : string
-
ID
- $record : string
-
Record XML
Return values
void —beginWrite()
Called before the writing process begins.
public
beginWrite() : void
Return values
void —endWrite()
Close out the writing process.
public
endWrite() : void
Return values
void —getBasePath()
Get base path for writes.
public
getBasePath() : string
Return values
string —getCombinedXML()
Support method for building combined XML document.
protected
getCombinedXML(string $innerXML) : string
Parameters
- $innerXML : string
-
XML for inside of document.
Return values
string —getFilename()
Get the filename for a specific record ID.
protected
getFilename(string $id, string $ext) : string
Parameters
- $id : string
-
ID of record to save.
- $ext : string
-
File extension to use.
Return values
string —Full path + filename.
saveDeletedRecords()
Create a tracking file to record the deletion of a record.
protected
saveDeletedRecords(string|array<string|int, mixed> $ids) : void
Parameters
- $ids : string|array<string|int, mixed>
-
ID(s) of deleted record(s).
Return values
void —saveFile()
Save a record to disk.
protected
saveFile(string $id, string $xml) : void
Parameters
- $id : string
-
Record ID to use for filename generation.
- $xml : string
-
XML to save.