Completed
Pull Request — newinternal (#285)
by Simon
07:17 queued 04:17
created

EmailHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendMail() 0 11 2
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
namespace Waca\Helpers;
10
11
use Waca\Helpers\Interfaces\IEmailHelper;
12
13
class EmailHelper implements IEmailHelper
14
{
15
    /**
16
     * @param string $to
17
     * @param string $subject
18
     * @param string $content
19
     * @param array  $headers Extra headers to include
20
     */
21
    public function sendMail($to, $subject, $content, $headers = array())
22
    {
23
        $headers['From'] = '[email protected]';
24
        $headerString = '';
25
26
        foreach ($headers as $header => $headerValue) {
27
            $headerString .= $header . ': ' . $headerValue . "\r\n";
28
        }
29
30
        mail($to, $subject, $content, $headerString);
31
    }
32
}