Grima 2018-08
Whispering into Alma's ear
Public Member Functions | Protected Attributes | List of all members
ISO2709RecordSetIterator Class Reference
Inheritance diagram for ISO2709RecordSetIterator:
MARC21RecordSetIterator

Public Member Functions

  __construct ( $input)
 
  valid ()
 
  current ()
 
  key ()
 
  next ()
 
  rewind ()
 

Protected Attributes

  $input
 
  $currentPosition
 
  $currentRecord
 
  $valid
 
  $RecordTerminator
 
  $prepend
 

Detailed Description

Definition at line 17 of file ISO2709.php.

Constructor & Destructor Documentation

◆ __construct()

ISO2709RecordSetIterator::__construct (   $input )

Reimplemented in MARC21RecordSetIterator.

Definition at line 19 of file ISO2709.php.

19 {
20 if( is_string( $input ) ) $input = fopen( $input, "rb" );
21 if( !is_resource( $input ) ) throw new Exception("ISO2709RecordSetIterator requires a file resource, filename, or URL to be created");
22 $this->input = $input;
23 $this->recordClass = "ISO2709Record";
24 $this->RecordTerminator = ISO2709::RecordTerminator;
25 $this->prepend = "";
26 }
const RecordTerminator
Definition: ISO2709.php:121

References $input, and ISO2709\RecordTerminator.

Member Function Documentation

◆ current()

ISO2709RecordSetIterator::current ( )

Definition at line 28 of file ISO2709.php.

28 {
30 }

References $currentRecord.

◆ key()

ISO2709RecordSetIterator::key ( )

Definition at line 31 of file ISO2709.php.

31 {
33 }

References $currentPosition.

◆ next()

ISO2709RecordSetIterator::next ( )

Definition at line 34 of file ISO2709.php.

34 {
35 if( $this->currentRecord === null ) $this->currentRecord = new $this->recordClass();
36 $this->currentPosition++;
37 $string = stream_get_line( $this->input, 99999, $this->RecordTerminator );
38 $this->valid = true;
39 if( $string === false ) $this->valid = false;
40 else $this->currentRecord->loadFromString( $this->prepend . $string );
41 $this->prepend = "";
42 }

References valid().

Referenced by rewind().

◆ rewind()

ISO2709RecordSetIterator::rewind ( )

Definition at line 43 of file ISO2709.php.

43 {
44 if($this->currentPosition !== null) rewind( $this->input );
45 $this->currentPosition = -1;
46 $this->currentRecord = new $this->recordClass();
47 $this->next();
48 }

References next(), and rewind().

Referenced by rewind().

◆ valid()

ISO2709RecordSetIterator::valid ( )

Definition at line 27 of file ISO2709.php.

References $valid.

Referenced by next().

Member Data Documentation

◆ $currentPosition

ISO2709RecordSetIterator::$currentPosition
protected

Definition at line 18 of file ISO2709.php.

Referenced by key().

◆ $currentRecord

ISO2709RecordSetIterator::$currentRecord
protected

Definition at line 18 of file ISO2709.php.

Referenced by current().

◆ $input

ISO2709RecordSetIterator::$input
protected

Definition at line 18 of file ISO2709.php.

Referenced by __construct(), and MARC21RecordSetIterator\__construct().

◆ $prepend

ISO2709RecordSetIterator::$prepend
protected

Definition at line 18 of file ISO2709.php.

◆ $RecordTerminator

ISO2709RecordSetIterator::$RecordTerminator
protected

Definition at line 18 of file ISO2709.php.

◆ $valid

ISO2709RecordSetIterator::$valid
protected

Definition at line 18 of file ISO2709.php.

Referenced by valid().


The documentation for this class was generated from the following file: