MarcCollectionFile
in package
implements
Iterator
MARC collection class for streaming a file.
Tags
Interfaces, Classes, Traits and Enums
- Iterator
Table of Contents
- $messageCallback : callable
- Message callback
- $position : int
- Iteration position
- $record : string
- Current record
- $serializations : array<string|int, mixed>
- Supported serialization formats
- $stream : SerializationFileInterface
- Serialized format stream
- __construct() : mixed
- Constructor
- current() : mixed
- Iterator: Return current record.
- key() : mixed
- Iterator: Return current key.
- next() : void
- Iterator: Advance to the next record.
- rewind() : void
- Iterator: Rewind to the beginning.
- setFile() : void
- Set MARC record file
- valid() : bool
- Iterator: Check if current position is valid.
Properties
$messageCallback
Message callback
protected
callable
$messageCallback
$position
Iteration position
protected
int
$position
= 0
$record
Current record
protected
string
$record
= ''
$serializations
Supported serialization formats
protected
array<string|int, mixed>
$serializations
= ['ISO2709' => \VuFind\Marc\Serialization\Iso2709::class, 'MARCXML' => \VuFind\Marc\Serialization\MarcXml::class, 'JSON' => \VuFind\Marc\Serialization\MarcInJson::class]
$stream
Serialized format stream
protected
SerializationFileInterface
$stream
Methods
__construct()
Constructor
public
__construct([string $file = '' ][, callable $messageCallback = null ]) : mixed
Parameters
- $file : string = ''
-
MARC record collection file in MARCXML or ISO2709 format
- $messageCallback : callable = null
-
Callback triggered for any messages with message string and error level (similar to https://www.php.net/manual/en/function.error-reporting.php)
Return values
mixed —current()
Iterator: Return current record.
public
current() : mixed
Return values
mixed —key()
Iterator: Return current key.
public
key() : mixed
Return values
mixed —next()
Iterator: Advance to the next record.
public
next() : void
Return values
void —rewind()
Iterator: Rewind to the beginning.
public
rewind() : void
Return values
void —setFile()
Set MARC record file
public
setFile(string $file) : void
Parameters
- $file : string
-
MARC record collection file in MARCXML or ISO2709 format
Tags
Return values
void —valid()
Iterator: Check if current position is valid.
public
valid() : bool