RecordCollection
extends AbstractRecordCollection
in package
EIT record collection.
Largely copied from the WorldCat record collection
Tags
Table of Contents
- $offset : int
- Zero-based offset in complete search result.
- $pointer : int
- Array pointer
- $records : array<string|int, mixed>
- Response records.
- $response : array<string|int, mixed>
- Raw response.
- $source : string
- Source identifier
- __construct() : void
- Constructor.
- add() : void
- Add a record to the collection.
- count() : int
- Return number of records in collection.
- current() : RecordInterface
- Return record at current collection index.
- first() : RecordInterface|null
- Return first record in response.
- getErrors() : array<string|int, mixed>
- Return any errors.
- getFacets() : array<string|int, mixed>
- Return facet information.
- getOffset() : int
- Return offset in the total search result set.
- getRecords() : array<string|int, mixed>
- Return records.
- getSourceIdentifier() : string
- Return the source backend identifier.
- getTotal() : int
- Return total number of records found.
- has() : bool
- Check if the collection contains the given record
- key() : int
- Return current collection index.
- next() : void
- Move to next collection index.
- replace() : void
- Replace a record in the collection.
- rewind() : void
- Rewind collection index.
- setSourceIdentifier() : void
- Set the source backend identifier.
- setSourceIdentifiers() : void
- Set the source backend identifiers.
- shuffle() : bool
- Shuffles records.
- slice() : void
- Slice the record list.
- valid() : bool
- Return true if current collection index is valid.
Properties
$offset
Zero-based offset in complete search result.
protected
int
$offset
= 0
$pointer
Array pointer
protected
int
$pointer
= 0
$records
Response records.
protected
array<string|int, mixed>
$records
= []
$response
Raw response.
protected
array<string|int, mixed>
$response
$source
Source identifier
protected
string
$source
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $response) : void
Parameters
- $response : array<string|int, mixed>
-
EIT response
Return values
void —add()
Add a record to the collection.
public
add(RecordInterface $record[, bool $checkExisting = true ]) : void
Parameters
- $record : RecordInterface
-
Record to add
- $checkExisting : bool = true
-
Whether to check for existing record in the collection (slower, but makes sure there are no duplicates)
Return values
void —count()
Return number of records in collection.
public
count() : int
Return values
int —current()
Return record at current collection index.
public
current() : RecordInterface
Return values
RecordInterface —first()
Return first record in response.
public
first() : RecordInterface|null
Return values
RecordInterface|null —getErrors()
Return any errors.
public
getErrors() : array<string|int, mixed>
Each error can be a translatable string or an array that the Flashmessages view helper understands.
Return values
array<string|int, mixed> —getFacets()
Return facet information.
public
getFacets() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOffset()
Return offset in the total search result set.
public
getOffset() : int
Return values
int —getRecords()
Return records.
public
getRecords() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSourceIdentifier()
Return the source backend identifier.
public
getSourceIdentifier() : string
Return values
string —getTotal()
Return total number of records found.
public
getTotal() : int
Return values
int —has()
Check if the collection contains the given record
public
has(RecordInterface $record) : bool
Parameters
- $record : RecordInterface
-
Record to check
Return values
bool —key()
Return current collection index.
public
key() : int
Return values
int —next()
Move to next collection index.
public
next() : void
Return values
void —replace()
Replace a record in the collection.
public
replace(RecordInterface $record, RecordInterface $replacement) : void
Parameters
- $record : RecordInterface
-
Record to be replaced
- $replacement : RecordInterface
-
Replacement record
Return values
void —rewind()
Rewind collection index.
public
rewind() : void
Return values
void —setSourceIdentifier()
Set the source backend identifier.
public
setSourceIdentifier(string $identifier) : void
Parameters
- $identifier : string
-
Backend identifier
Tags
Return values
void —setSourceIdentifiers()
Set the source backend identifiers.
public
setSourceIdentifiers(string $recordSourceId[, string $searchBackendId = '' ]) : void
Parameters
- $recordSourceId : string
-
Record source identifier
- $searchBackendId : string = ''
-
Search backend identifier (if different from $recordSourceId)
Return values
void —shuffle()
Shuffles records.
public
shuffle() : bool
Return values
bool —slice()
Slice the record list.
public
slice(int $offset, int $limit) : void
Parameters
- $offset : int
-
Offset
- $limit : int
-
Limit
Return values
void —valid()
Return true if current collection index is valid.
public
valid() : bool