Code Duplication    Length = 9-18 lines in 2 locations

src/Bibs/Bib.php 1 location

@@ 102-119 (lines=18) @@
99
    /**
100
     * Save the MARC record.
101
     */
102
    public function save()
103
    {
104
        // If initialized from an SRU record, we need to fetch the
105
        // remaining parts of the Bib record.
106
        $this->init();
107
108
        // Inject the MARC record
109
        $marcXml = new QuiteSimpleXMLElement($this->_marc->toXML('UTF-8', false, false));
110
        $this->data->first('record')->replace($marcXml);
111
112
        // Serialize
113
        $newData = $this->data->asXML();
114
115
        // Alma doesn't like namespaces
116
        $newData = str_replace(' xmlns="http://www.loc.gov/MARC21/slim"', '', $newData);
117
118
        return $this->client->putXML($this->url(), $newData);
119
    }
120
121
    /**
122
     * Get the MMS ID of the linked record in network zone.

src/Bibs/Holding.php 1 location

@@ 73-81 (lines=9) @@
70
    /**
71
     * Save the holding.
72
     */
73
    public function save()
74
    {
75
        $marcXml = $this->getRecord()->toXML('UTF-8', false, false);
76
        $marcXml = new QuiteSimpleXMLElement($marcXml);
77
        $this->data->first('record')->replace($marcXml);
78
        $newData = $this->data->asXML();
79
80
        return $this->client->putXML($this->url(), $newData);
81
    }
82
83
    /**
84
     * Called when data is available to be processed.