File_MARC
[ class tree: File_MARC ] [ index: File_MARC ] [ all elements ]

Class: File_MARC_List

Source Location: /File_MARC-0.2.3/MARC/List.php

Class Overview

Structures_LinkedList_Double
   |
   --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.


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 74]
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.  }



[ Top ]


Method Detail

key   [line 86]

string key( )

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

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:26:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.