예제 #1
0
 /**
  * @param DataField $field
  *
  * @return string
  */
 private function convertDataField(DataField $field)
 {
     $subFields = array_map(function (SubField $subField) {
         return $this->convertSubField($subField);
     }, $field->getSubFields());
     return (string) implode($field->getIndicators()) . implode($subFields) . File_MARC::END_OF_FIELD;
 }
예제 #2
0
 /**
  * @param array $content
  *
  * @return DataField
  */
 private function convertArrayToDataField(array $content)
 {
     $field = new DataField($content['tag'], str_split($content['ind']));
     foreach ($content['subfield'] as $subfield) {
         $field->addSubField(new SubField($subfield['code'], $subfield['data']));
     }
     return $field;
 }
예제 #3
0
 /**
  * @param \File_MARC_Data_Field $field
  *
  * @return DataField
  */
 private function convertDataField(\File_MARC_Data_Field $field)
 {
     $tag = $field->getTag();
     $ind1 = $field->getIndicator(1);
     $ind2 = $field->getIndicator(2);
     $dataField = new DataField($tag, [$ind1, $ind2]);
     foreach ($field->getSubfields() as $subField) {
         $dataField->addSubField($this->convertSubfield($subField));
     }
     return $dataField;
 }
예제 #4
0
 private function configDataField()
 {
     $this->reader->elementMap['{http://www.loc.gov/MARC21/slim}datafield'] = function (XMLReader $reader) {
         $tag = $reader->getAttribute('tag');
         $ind1 = $reader->getAttribute('ind1');
         $ind2 = $reader->getAttribute('ind2');
         $field = new DataField($tag, [$ind1, $ind2]);
         $children = $reader->parseInnerTree();
         foreach ($children as $child) {
             $field->addSubField(new SubField($child['attributes']['code'], $child['value']));
         }
         return $field;
     };
 }