Completed
Push — rbac ( 1ec5d5...5c33ef )
by Simon
04:39
created

EmailHelper::sendMail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 6
c 0
b 0
f 0
nc 2
nop 4
dl 0
loc 11
rs 9.4285
ccs 8
cts 8
cp 1
crap 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 2
    public function sendMail($to, $subject, $content, $headers = array())
22
    {
23 2
        $headers['From'] = '[email protected]';
24 2
        $headerString = '';
25
26 2
        foreach ($headers as $header => $headerValue) {
27 2
            $headerString .= $header . ': ' . $headerValue . "\r\n";
28 2
        }
29
30 2
        mail($to, $subject, $content, $headerString);
31
    }
32
}