PHPMailerOverride   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 32
ccs 9
cts 10
cp 0.9
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessageEnvelopeParts() 0 7 2
A getFullMessageEnvelope() 0 5 1
A __construct() 0 4 1
1
<?php
2
3
namespace ByJG\Mail\Override;
4
5
use ByJG\Mail\Exception\InvalidMessageFormatException;
6
use PHPMailer\PHPMailer\PHPMailer;
7
8
class PHPMailerOverride extends PHPMailer
9
{
10 8
    public function __construct($exceptions = null)
11
    {
12 8
        parent::__construct($exceptions);
13 8
        $this->XMailer = 'PHPMailer (https://github.com/PHPMailer/PHPMailer)';
14
    }
15
16
    /**
17
     * @return string
18
     * @throws InvalidMessageFormatException
19
     * @throws \PHPMailer\PHPMailer\Exception
20
     */
21 8
    public function getFullMessageEnvelope()
22
    {
23 8
        $parts = $this->getMessageEnvelopeParts();
24
25 8
        return $parts['header'] . $parts['body'];
26
    }
27
28
    /**
29
     * @return array
30
     * @throws InvalidMessageFormatException
31
     * @throws \PHPMailer\PHPMailer\Exception
32
     */
33 8
    public function getMessageEnvelopeParts()
34
    {
35 8
        if (!$this->preSend()) {
36
            throw new InvalidMessageFormatException('Invalid Message Format');
37
        }
38
39 8
        return ["header" => $this->MIMEHeader, "body" => $this->MIMEBody];
40
    }
41
}
42