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

Class: File_MARC_List

Source Location: /File_MARC-1.4.1/File/MARC/List.php

Class Overview

SplDoublyLinkedList
   |
   --File_MARC_List

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


Author(s):

Variables

Methods


Child classes:

File_MARC_Field
The File_MARC_Field class is expected to be extended to reflect the requirements of control and data fields.

Inherited Variables

Inherited Methods

Class: SplDoublyLinkedList (Internal Class)

add ( $index, $newval )
bottom ( )
count ( )
current ( )
getIteratorMode ( )
isEmpty ( )
key ( )
next ( )
offsetExists ( $index )
offsetGet ( $index )
offsetSet ( $index, $newval )
offsetUnset ( $index )
pop ( )
prev ( )
push ( $value )
rewind ( )
serialize ( )
setIteratorMode ( $flags )
shift ( )
top ( )
unserialize ( $serialized )
unshift ( $value )
valid ( )

Class Details

[line 74]
The File_MARC_List class extends the SplDoublyLinkedList 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 ]


Class Variables

$position =

[line 82]

Position of the subfield
  • Access: protected

Type:   int


[ Top ]



Method Detail

appendNode   [line 162]

void appendNode( mixed $new_node)

Adds a node onto the linked list.
  • Access: public

Parameters:

mixed   $new_node   —  New node to add to the list

[ Top ]

deleteNode   [line 192]

void deleteNode( mixed $node)

Deletes a node from the linked list.
  • Access: public

Parameters:

mixed   $node   —  Node to delete from the list

[ Top ]

getPosition   [line 243]

int getPosition( )

Return position of the subfield
  • Return: data

[ Top ]

insertNode   [line 118]

bool insertNode( mixed $new_node, mixed $existing_node, [bool $before = false])

Inserts a node into the linked list, based on a reference node that already exists in the list.
  • Return: Success or failure
  • Access: public

Parameters:

mixed   $new_node   —  New node to add to the list
mixed   $existing_node   —  Reference position node
bool   $before   —  Insert new node before or after the existing node

[ Top ]

key   [line 96]

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

Overrides SplDoublyLinkedList::key ( ) (parent method not documented)
[ Top ]

prependNode   [line 178]

void prependNode( mixed $new_node)

Adds a node to the start of the linked list.
  • Access: public

Parameters:

mixed   $new_node   —  New node to add to the list

[ Top ]

setPosition   [line 231]

void setPosition( string $pos)

Sets position of the subfield

Parameters:

string   $pos   —  new position of the subfield

[ Top ]


Documentation generated on Wed, 13 Nov 2019 12:37:08 -0500 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.