Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
     };
 }