Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
PublicationDetails
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getPlace
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __toString
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Class encapsulating publication details.
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  RecordDrivers
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:plugins:record_drivers Wiki
28 */
29
30namespace VuFind\RecordDriver\Response;
31
32/**
33 * Class encapsulating publication details.
34 *
35 * @category VuFind
36 * @package  RecordDrivers
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/development:plugins:record_drivers Wiki
40 */
41class PublicationDetails
42{
43    /**
44     * Place of publication
45     *
46     * @var string
47     */
48    protected $place;
49
50    /**
51     * Name of publisher
52     *
53     * @var string
54     */
55    protected $name;
56
57    /**
58     * Date of publication
59     *
60     * @var string
61     */
62    protected $date;
63
64    /**
65     * Constructor
66     *
67     * @param string $place Place of publication
68     * @param string $name  Name of publisher
69     * @param string $date  Date of publication
70     */
71    public function __construct($place, $name, $date)
72    {
73        $this->place = $place;
74        $this->name = $name;
75        $this->date = $date;
76    }
77
78    /**
79     * Get place of publication
80     *
81     * @return string
82     */
83    public function getPlace()
84    {
85        return $this->place;
86    }
87
88    /**
89     * Get name of publisher
90     *
91     * @return string
92     */
93    public function getName()
94    {
95        return $this->name;
96    }
97
98    /**
99     * Get date of publication
100     *
101     * @return string
102     */
103    public function getDate()
104    {
105        return $this->date;
106    }
107
108    /**
109     * Represent object as a string
110     *
111     * @return string
112     */
113    public function __toString()
114    {
115        return trim(
116            preg_replace(
117                '/\s+/',
118                ' ',
119                implode(' ', [$this->place, $this->name, $this->date])
120            )
121        );
122    }
123}