Completed
Push — master ( 9ab85d...15403c )
by Beñat
04:37 queued 01:49
created

LocalMailer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015-2016 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\WPFoundation\Configuration\Mailer;
13
14
/**
15
 * Class that configures the parameters used by "wp_mail" to send emails using local built in mailer.
16
 *
17
 * Define the following global variables in your "wp-config-custom.php" file:
18
 *
19
 *    MAILER_FROM: The email address that will be shown to the receiver.
20
 *    MAILER_FROM_NAME: The name that will be shown to the receiver.
21
 *
22
 * Remember to add this class to your theme constructor.
23
 *
24
 * @author Gorka Laucirica <[email protected]>
25
 */
26
final class LocalMailer
27
{
28
    /**
29
     * Constructor.
30
     */
31
    public function __construct()
32
    {
33
        add_action('phpmailer_init', [$this, 'mailer']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_action() seems unnecessary as the function has no side-effects.
Loading history...
34
    }
35
36
    /**
37
     * Configures the mailer according to the parameters in "wp-config-custom.php".
38
     *
39
     * @param object $phpMailer The PhpMailer instance
40
     */
41
    public function mailer($phpMailer)
42
    {
43
        $phpMailer->Sender = MAILER_FROM;
44
        $phpMailer->From = MAILER_FROM;
45
        $phpMailer->FromName = MAILER_FROM_NAME;
46
    }
47
}
48