Grima 2018-08
Whispering into Alma's ear
Public Member Functions | Public Attributes | List of all members
ISO2709Field Class Reference

Public Member Functions

  __construct ( $tag, $data, $indicators="", $subfields=array(), $directoryEntry=array(), $record=null)
 
  remove ()
 
  delete ()
 
  appendSubfield ( $subfield, $arg2=null)
 
  insertSubfieldBefore ( $identifier, $subfield, $arg3=null)
 
  removeSubfield (\ISO2709Subfield $subfield)
 
  getOneSubfield ( $identifier)
 
  getSubfields ( $identifier)
 
  AsMnemonicString ( $field_initiator="=", $tag_terminator=" ", $identifier_initiator="\$", $field_terminator="\r\n", $space_replacer=" ")
 

Public Attributes

  $tag
 
  $data
 
  $indicators
 
  $subfields
 
  $directoryEntry
 

Detailed Description

Definition at line 573 of file ISO2709.php.

Constructor & Destructor Documentation

◆ __construct()

ISO2709Field::__construct (   $tag,
  $data,
  $indicators = "",
  $subfields = array(),
  $directoryEntry = array(),
  $record = null 
)

Definition at line 575 of file ISO2709.php.

575 {
576 $this->tag=$tag;
577 $this->data=$data;
578 $this->indicators = $indicators;
579 $this->directoryEntry = $directoryEntry;
580 if( !isset( $this->directoryEntry[0] ) ) $this->directoryEntry[0] = $tag;
581 if( !isset( $this->directoryEntry[3] ) ) $this->directoryEntry[3] = "";
582 $this->record = $record;
583 $this->subfields = array();
584 foreach( $subfields as $v ) { $this->appendSubfield( $v ); }
585 }
$directoryEntry
Definition: ISO2709.php:574
appendSubfield( $subfield, $arg2=null)
Definition: ISO2709.php:592
$indicators
Definition: ISO2709.php:574
$subfields
Definition: ISO2709.php:574

References $data, $directoryEntry, $indicators, $subfields, $tag, and appendSubfield().

Member Function Documentation

◆ appendSubfield()

ISO2709Field::appendSubfield (   $subfield,
  $arg2 = null 
)

Definition at line 592 of file ISO2709.php.

592 {
593 if( is_a( $subfield, "ISO2709Subfield" ) ) {
594 $subfield->field = $this;
595 $this->subfields[] = $subfield;
596 } else {
597 $this->appendSubfield( new ISO2709Subfield( $subfield, $arg2 ) );
598 }
599 }

References appendSubfield().

Referenced by __construct(), and appendSubfield().

◆ AsMnemonicString()

ISO2709Field::AsMnemonicString (   $field_initiator = "=",
  $tag_terminator = "  ",
  $identifier_initiator = "\$",
  $field_terminator = "\r\n",
  $space_replacer = " " 
)

Definition at line 645 of file ISO2709.php.

651 {
652 $sub = "";
653 foreach( $this->subfields as $vv ) {
654 $sub .= $identifier_initiator . $vv->identifier . $vv->data;
655 }
656 $indicators = str_replace(" ",$space_replacer, $this->indicators );
657 $data = str_replace(" ",$space_replacer, $this->data );
658 return sprintf( "%s%3.3s%s%s%s%s%s", $field_initiator, $this->tag,
659 $tag_terminator, $indicators, $sub, $data, $field_terminator );
660 }

References $data, and $indicators.

◆ delete()

ISO2709Field::delete ( )

Definition at line 589 of file ISO2709.php.

589 {
590 return $this->record->removeField( $this );
591 }

◆ getOneSubfield()

ISO2709Field::getOneSubfield (   $identifier )

Definition at line 631 of file ISO2709.php.

631 {
632 foreach( $this->subfields as $v ) {
633 if( $v->identifier === $identifier ) return $v;
634 }
635 return false;
636 }

◆ getSubfields()

ISO2709Field::getSubfields (   $identifier )

Definition at line 637 of file ISO2709.php.

637 {
638 $ret = array();
639 foreach( $this->subfields as $v ) {
640 if( $v->identifier === $identifier ) $ret[] = $v;
641 }
642 return $ret;
643 }

◆ insertSubfieldBefore()

ISO2709Field::insertSubfieldBefore (   $identifier,
  $subfield,
  $arg3 = null 
)

Definition at line 602 of file ISO2709.php.

602 {
603 if( is_a( $subfield, "ISO2709Subfield" ) ) {
604 $found = false;
605 foreach( $this->subfields as $k => $v ) {
606 if( $v->identifier === $identifier ) {
607 array_splice($this->subfields,$k,0,array($subfield));
608 $this->subfields = array_values($this->subfields);
609 $found = true;
610 if( $k > 0 ) {
611 if (preg_match("/(.*?)( *[\:\/=] *)$/",$this->subfields[$k-1]->data,$m)) {
612 $this->subfields[$k-1]->data = $m[1];
613 $this->subfields[$k]->data .= $m[2];
614 }
615 }
616 break;
617 }
618 }
619 return $found;
620 } else {
621 return $this->insertSubfieldBefore( $identifier, new ISO2709Subfield( $subfield, $arg3 ) );
622 }
623 }
insertSubfieldBefore( $identifier, $subfield, $arg3=null)
Definition: ISO2709.php:602

References insertSubfieldBefore().

Referenced by insertSubfieldBefore().

◆ remove()

ISO2709Field::remove ( )

Definition at line 586 of file ISO2709.php.

586 {
587 return $this->record->removeField( $this );
588 }

◆ removeSubfield()

ISO2709Field::removeSubfield ( \ISO2709Subfield  $subfield )

Definition at line 625 of file ISO2709.php.

625 {
626 foreach( $this->subfields as $k => $v ) {
627 if( $v === $subfield ) unset( $this->subfields[$k] );
628 }
629 $this->subfields = array_values( $this->subfields );
630 }

Member Data Documentation

◆ $data

ISO2709Field::$data

Definition at line 574 of file ISO2709.php.

Referenced by __construct(), and AsMnemonicString().

◆ $directoryEntry

ISO2709Field::$directoryEntry

Definition at line 574 of file ISO2709.php.

Referenced by __construct().

◆ $indicators

ISO2709Field::$indicators

Definition at line 574 of file ISO2709.php.

Referenced by __construct(), and AsMnemonicString().

◆ $subfields

ISO2709Field::$subfields

Definition at line 574 of file ISO2709.php.

Referenced by __construct().

◆ $tag

ISO2709Field::$tag

Definition at line 574 of file ISO2709.php.

Referenced by __construct().


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