Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Message
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
5.20
0.00% covered (danger)
0.00%
0 / 1
 getFrom
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCc
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBcc
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getReplyTo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Tweaked Laminas Message class
5 *
6 * PHP version 8
7 *
8 * Copyright (C) The National Library of Finland 2023.
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  Mailer
25 * @author   Ere Maijala <ere.maijala@helsinki.fi>
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\Mailer;
31
32use Laminas\Mail\AddressList;
33
34/**
35 * Tweaked Laminas Message class
36 *
37 * @category VuFind
38 * @package  Mailer
39 * @author   Ere Maijala <ere.maijala@helsinki.fi>
40 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
41 * @link     https://vufind.org/wiki/development Wiki
42 */
43class Message extends \Laminas\Mail\Message
44{
45    /**
46     * Retrieve list of From senders
47     *
48     * Returns our local "From" class
49     *
50     * @return AddressList
51     */
52    public function getFrom()
53    {
54        return $this->getAddressListFromHeader('from', From::class);
55    }
56
57    /**
58     * Access the address list of the To header
59     *
60     * @return AddressList
61     */
62    public function getTo()
63    {
64        return $this->getAddressListFromHeader('to', To::class);
65    }
66
67    /**
68     * Retrieve list of CC recipients
69     *
70     * @return AddressList
71     */
72    public function getCc()
73    {
74        return $this->getAddressListFromHeader('cc', Cc::class);
75    }
76
77    /**
78     * Retrieve list of BCC recipients
79     *
80     * @return AddressList
81     */
82    public function getBcc()
83    {
84        return $this->getAddressListFromHeader('bcc', Bcc::class);
85    }
86
87    /**
88     * Access the address list of the Reply-To header
89     *
90     * @return AddressList
91     */
92    public function getReplyTo()
93    {
94        return $this->getAddressListFromHeader('reply-to', ReplyTo::class);
95    }
96}