Class File_MARC_List


The File_MARC_List class extends the Structures_LinkedList_Double class to override the key() method in a meaningful way for foreach() iterators.

For the list of File_MARC_Field objects in a File_MARC_Record object, the key() method returns the tag name of the field.

For the list of File_MARC_Subfield objects in a File_MARC_Data_Field object, the key() method returns the code of the subfield.

  1.  // Iterate through the fields in a record with key=>value iteration
  2.   foreach ($record->getFields(as $tag=>$value{
  3.      print "$tag";
  4.      if ($value instanceof File_MARC_Control_Field{
  5.          print $value->getData();
  6.      }
  7.      else {
  8.          // Iterate through the subfields in this data field
  9.                   foreach ($value->getSubfields(as $code=>$subdata{
  10.              print "_$code";
  11.          }
  12.      }
  13.      print "\n";
  14.  }

Located in /MARC/List.php (line 73)

Method Summary
string key ()
key (line 85)

Returns the tag for a File_MARC_Field object, or the code for a File_MARC_Subfield object.

This method enables you to use a foreach iterator to retrieve the tag or code as the key for the iterator.

  • return: returns the tag or code
string key ()

Documentation generated on Mon, 01 Jan 2007 23:44:41 -0500 by phpDocumentor 1.3.1