private function _decode($text)
    {
        $marc = new $this->record_class($this);

        // Store leader
        $marc->setLeader($text->leader);

        // go through all fields
        foreach ($text->fields as $field) {
            foreach ($field as $tag => $values) {
                // is it a control field?
                if (strpos($tag, '00') === 0) {
                    $marc->appendField(new File_MARC_Control_Field($tag, $values));
                } else {
                    // it's a data field -- get the subfields
                    $subfield_data = array();
                    foreach ($values->subfields as $subfield) {
                        foreach ($subfield as $sf_code => $sf_value) {
                            $subfield_data[] = new File_MARC_Subfield($sf_code, $sf_value);
                        }
                    }
                    // If the data is invalid, let's just ignore the one field
                    try {
                        $new_field = new File_MARC_Data_Field($tag, $subfield_data, $values->ind1, $values->ind2);
                        $marc->appendField($new_field);
                    } catch (Exception $e) {
                        $marc->addWarning($e->getMessage());
                    }
                }
            }

        }
        return $marc;
    }
private function _decode($text)
    {
        $marc = new $this->record_class($this);

        // Store leader
        $marc->setLeader($text->leader);

        // go through all fields
        foreach ($text->fields as $field) {
            foreach ($field as $tag => $values) {
                // is it a control field?
                if (strpos($tag, '00') === 0) {
                    $marc->appendField(new File_MARC_Control_Field($tag, $values));
                } else {
                    // it's a data field -- get the subfields
                    $subfield_data = array();
                    foreach ($values->subfields as $subfield) {
                        foreach ($subfield as $sf_code => $sf_value) {
                            $subfield_data[] = new File_MARC_Subfield($sf_code, $sf_value);
                        }
                    }
                    // If the data is invalid, let's just ignore the one field
                    try {
                        $new_field = new File_MARC_Data_Field($tag, $subfield_data, $values->ind1, $values->ind2);
                        $marc->appendField($new_field);
                    } catch (Exception $e) {
                        $marc->addWarning($e->getMessage());
                    }
                }
            }

        }
        return $marc;
    }
private function _decode ( $ text ) { $ marc = new $ this -> record_class ( $ this ) ; // Store leader $ marc -> setLeader ( $ text -> leader ) ; // go through all fields foreach ( $ text -> fields as $ field ) { foreach ( $ field as $ tag => $ values ) { // is it a control field? if ( strpos ( $ tag , '00' ) === 0 ) { $ marc -> appendField ( new File_MARC_Control_Field ( $ tag , $ values ) ) ; } else { // it's a data field -- get the subfields $ subfield_data = array ( ) ; foreach ( $ values -> subfields as $ subfield ) { foreach ( $ subfield as $ sf_code => $ sf_value ) { $ subfield_data [ ] = new File_MARC_Subfield ( $ sf_code , $ sf_value ) ; } } // If the data is invalid, let's just ignore the one field try { $ new_field = new File_MARC_Data_Field ( $ tag , $ subfield_data , $ values -> ind1 , $ values -> ind2 ) ; $ marc -> appendField ( $ new_field ) ; } catch ( Exception $ e ) { $ marc -> addWarning ( $ e -> getMessage ( ) ) ; } } } } return $ marc ; }
Decode a given MARC-in-JSON record

@param string $text MARC-in-JSON record element

@return File_MARC_Record Decoded File_MARC_Record object
Decode a given MARC - in - JSON record