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
Entry
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
 addDCFormat
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDCDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDCDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDCFormats
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Laminas\Feed\Entry extension for Dublin Core
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2010.
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  Feed_Plugins
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/development Wiki
28 */
29
30namespace VuFind\Feed\Writer\Extension\DublinCore;
31
32use Laminas\Feed\Writer\Extension\ITunes\Entry as ParentEntry;
33
34/**
35 * Laminas\Feed\Entry extension for Dublin Core
36 *
37 * Note: There doesn't seem to be a generic base class for this functionality,
38 * and creating a class with no parent blows up due to unexpected calls to
39 * Itunes-related functionality. To work around this, we are extending the
40 * equivalent Itunes plugin. This works fine, but perhaps in future there will
41 * be a more elegant way to achieve the same effect.
42 *
43 * @category VuFind
44 * @package  Feed_Plugins
45 * @author   Demian Katz <demian.katz@villanova.edu>
46 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
47 * @link     https://vufind.org/wiki/development Wiki
48 */
49class Entry extends ParentEntry
50{
51    /**
52     * Formats
53     *
54     * @var array
55     */
56    protected $dcFormats = [];
57
58    /**
59     * Date
60     *
61     * @var string
62     */
63    protected $dcDate = null;
64
65    /**
66     * Add a Dublin Core format.
67     *
68     * @param string $format Format to add.
69     *
70     * @return void
71     */
72    public function addDCFormat($format)
73    {
74        $this->dcFormats[] = $format;
75    }
76
77    /**
78     * Set the Dublin Core date.
79     *
80     * @param string $date Date to set.
81     *
82     * @return void
83     */
84    public function setDCDate($date)
85    {
86        $this->dcDate = $date;
87    }
88
89    /**
90     * Get the Dublin Core date.
91     *
92     * @return string
93     */
94    public function getDCDate()
95    {
96        return $this->dcDate;
97    }
98
99    /**
100     * Get the Dublin Core formats.
101     *
102     * @return array
103     */
104    public function getDCFormats()
105    {
106        return $this->dcFormats;
107    }
108}