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

Class: File_MARC_Data_Field

Source Location: /File_MARC-0.1.2/MARC/Data_Field.php

Class Overview

Structures_LinkedList_DoubleNode
   |
   --File_MARC_Field
      |
      --File_MARC_Data_Field

The File_MARC_Data_Field class represents a single field in a MARC record.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: File_MARC_Field

File_MARC_Field::__construct()
File_MARC_Field constructor
File_MARC_Field::getTag()
Returns the tag for this File_MARC_Field object
File_MARC_Field::isEmpty()
Is empty
File_MARC_Field::setTag()
Sets the tag for this File_MARC_Field object
File_MARC_Field::toRaw()
Return field in raw MARC format (stub)
File_MARC_Field::__destruct()
Destroys the data field
File_MARC_Field::__toString()
Return Field formatted

Class Details

[line 53]
The File_MARC_Data_Field class represents a single field in a MARC record.

A MARC data field consists of a tag name, two indicators which may be null, and zero or more subfields represented by File_MARC_Subfield objects. Subfields are held within a linked list structure.



[ Top ]


Class Variables

$ind1 =

[line 60]

Value of the first indicator
  • Access: protected

Type:   string


[ Top ]

$ind2 =

[line 66]

Value of the second indicator
  • Access: protected

Type:   string


[ Top ]

$subfields =

[line 72]

Linked list of subfields
  • Access: protected

Type:   File_MARC_List


[ Top ]



Method Detail

__construct (Constructor)   [line 99]

File_MARC_Data_Field __construct( string $tag, [array $subfields = null], [string $ind1 = null], [string $ind2 = null])

File_MARC_Data_Field constructor

Create a new File_MARC_Data_Field object. The only required parameter is a tag. This enables programs to build up new fields programmatically.

  1.  // Example: Create a new data field
  2.  
  3.  // We can optionally create an array of subfields first
  4.  $subfields[= new File_MARC_Data_Subfield('a''Scott, Daniel.');
  5.  
  6.  // Create the new 100 field complete with a _a subfield and an indicator
  7.  $new_field = new File_MARC_Data_Field('100'$subfields0null);


Overrides File_MARC_Field::__construct() (File_MARC_Field constructor)

Parameters:

string   $tag   —  tag
array   $subfields   —  array of File_MARC_Subfield objects
string   $ind1   —  first indicator
string   $ind2   —  second indicator

[ Top ]

__destruct (Destructor)   [line 119]

void __destruct( )

Destroys the data field

Overrides File_MARC_Field::__destruct() (Destroys the data field)
[ Top ]

addSubfields   [line 246]

int addSubfields( array $subfields)

Adds an array of subfields to a File_MARC_Data_Field object

Appends subfields to existing subfields in the order in which they appear in the array. For finer grained control of the subfield order, use appendSubfield(), prependSubfield(), or insertSubfield() to add each subfield individually.

  • Return: returns the number of subfields that were added

Parameters:

array   $subfields   —  array of File_MARC_Subfield objects

[ Top ]

appendSubfield   [line 174]

File_MARC_Subfield appendSubfield( File_MARC_Subfield $new_subfield)

Appends subfield to subfield list

Adds a File_MARC_Subfield object to the end of the existing list of subfields.

  • Return: the new File_MARC_Subfield object

Parameters:

File_MARC_Subfield   $new_subfield   —  The subfield to add

[ Top ]

delete   [line 132]

void delete( )

Destroys the data field

[ Top ]

deleteSubfield   [line 274]

bool deleteSubfield( File_MARC_Subfield $subfield)

Delete a subfield from the field.
  • Return: Success or failure

Parameters:

File_MARC_Subfield   $subfield   — 

[ Top ]

getIndicator   [line 290]

string getIndicator( int $ind)

Get the value of an indicator
  • Return: returns indicator value if it exists, otherwise false

Parameters:

int   $ind   —  number of the indicator (1 or 2)

[ Top ]

getSubfield   [line 343]

File_MARC_Subfield getSubfield( [string $code = null])

Returns the first subfield that matches a requested code.
  • Return: returns the first subfield that matches $code, or false if no codes match $code

Parameters:

string   $code   —  subfield code for which the File_MARC_Subfield is retrieved

[ Top ]

getSubfields   [line 369]

File_MARC_List|array getSubfields( [string $code = null])

Returns an array of subfields that match a requested code, or a File_MARC_List that contains all of the subfields if the requested code is null.
  • Return: returns a linked list of all subfields if $code is null, an array of File_MARC_Subfield objects if one or more subfields match, or false if no codes match $code

Parameters:

string   $code   —  subfield code for which the File_MARC_Subfield is retrieved

[ Top ]

insertSubfield   [line 212]

File_MARC_Subfield insertSubfield( File_MARC_Subfield $new_field, File_MARC_Subfield $existing_field, [bool $before = false])

Inserts a field in the MARC record relative to an existing field

Inserts a File_MARC_Subfield object before or after an existing subfield.

  • Return: The new subfield

Parameters:

File_MARC_Subfield   $new_field   —  The subfield to add
File_MARC_Subfield   $existing_field   —  The target subfield
bool   $before   —  Insert the subfield before the existing subfield if true, after the existing subfield if false

[ Top ]

isEmpty   [line 398]

bool isEmpty( )

Checks if the field is empty.

Checks if the field is empty. If the field has at least one subfield with data, it is not empty.

  • Return: Returns true if the field is empty, otherwise false

Overrides File_MARC_Field::isEmpty() (Is empty)
[ Top ]

prependSubfield   [line 192]

File_MARC_Subfield prependSubfield( File_MARC_Subfield $new_subfield)

Prepends subfield to subfield liss

Adds a File_MARC_Subfield object to the start of the existing list of subfields.

  • Return: the new File_MARC_Subfield object

Parameters:

File_MARC_Subfield   $new_subfield   —  The subfield to add

[ Top ]

setIndicator   [line 312]

string setIndicator( int $ind, string $value)

Set the value of an indicator
  • Return: returns indicator value if it exists, otherwise false

Parameters:

int   $ind   —  number of the indicator (1 or 2)
string   $value   —  value of the indicator

[ Top ]

toRaw   [line 454]

string toRaw( )

Return Field in Raw MARC

Return the Field formatted in Raw MARC for saving into MARC files

  • Return: Raw MARC

Overrides File_MARC_Field::toRaw() (Return field in raw MARC format (stub))
[ Top ]

__toString   [line 429]

string __toString( )

Return Field formatted

Return Field as a formatted string.

  • Return: Formatted output of Field

Overrides File_MARC_Field::__toString() (Return Field formatted)
[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:56:53 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.