Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
IndividualRecordWriterStrategy
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 beginWrite
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addDeletedRecord
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addRecord
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 endWrite
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Strategy for writing records to disk individually.
5 *
6 * PHP version 7
7 *
8 * Copyright (c) Demian Katz 2016.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  Harvest_Tools
25 * @author   Demian Katz <demian.katz@villanova.edu>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org/wiki/indexing:oai-pmh Wiki
28 */
29
30namespace VuFindHarvest\RecordWriterStrategy;
31
32/**
33 * Strategy for writing records to disk individually.
34 *
35 * @category VuFind
36 * @package  Harvest_Tools
37 * @author   Demian Katz <demian.katz@villanova.edu>
38 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39 * @link     https://vufind.org/wiki/indexing:oai-pmh Wiki
40 */
41class IndividualRecordWriterStrategy extends AbstractRecordWriterStrategy
42{
43    /**
44     * Called before the writing process begins.
45     *
46     * @return void
47     */
48    public function beginWrite()
49    {
50        // no special action needed.
51    }
52
53    /**
54     * Add the ID of a deleted record.
55     *
56     * @param string $id ID
57     *
58     * @return void
59     */
60    public function addDeletedRecord($id)
61    {
62        $this->saveDeletedRecords($id);
63    }
64
65    /**
66     * Add a non-deleted record.
67     *
68     * @param string $id     ID
69     * @param string $record Record XML
70     *
71     * @return void
72     */
73    public function addRecord($id, $record)
74    {
75        $this->saveFile($id, $record);
76    }
77
78    /**
79     * Close out the writing process.
80     *
81     * @return void
82     */
83    public function endWrite()
84    {
85        // no special action needed.
86    }
87}