Passed
Pull Request — 4 (#10048)
by Steve
12:03
created

Swift_Transport_SimpleMailInvoker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A mail() 0 7 2
1
<?php
2
3
/**
4
 * This file was copied in from swiftmailer/swiftmailer v5.4.12 after it was removed from switftmailer v6
5
 * It has been slightly modified to meet phpcs standards
6
 */
7
8
/*
9
 * This file is part of SwiftMailer.
10
 * (c) 2004-2009 Chris Corbyn
11
 *
12
 * For the full copyright and license information, please view the LICENSE file (MIT)
13
 * https://github.com/swiftmailer/swiftmailer/blob/181b89f18a90f8925ef805f950d47a7190e9b950/LICENSE
14
 */
15
16
/**
17
 * This is the implementation class for {@link Swift_Transport_MailInvoker}.
18
 *
19
 * @author     Chris Corbyn
20
 *
21
 * @internal
22
 */
23
// @codingStandardsIgnoreStart
24
// ignore missing namespace
25
class Swift_Transport_SimpleMailInvoker implements Swift_Transport_MailInvoker
26
// @codingStandardsIgnoreEnd* It has been slightly modified to meet phpcs standards
27
{
28
    /**
29
     * Send mail via the mail() function.
30
     *
31
     * This method takes the same arguments as PHP mail().
32
     *
33
     * @param string $to
34
     * @param string $subject
35
     * @param string $body
36
     * @param string $headers
37
     * @param string $extraParams
38
     *
39
     * @return bool
40
     */
41
    public function mail($to, $subject, $body, $headers = null, $extraParams = null)
42
    {
43
        if (!ini_get('safe_mode')) {
44
            return @mail($to, $subject, $body, $headers, $extraParams);
0 ignored issues
show
Bug introduced by
It seems like $extraParams can also be of type null; however, parameter $additional_params of mail() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
            return @mail($to, $subject, $body, $headers, /** @scrutinizer ignore-type */ $extraParams);
Loading history...
Bug introduced by
It seems like $headers can also be of type null; however, parameter $additional_headers of mail() does only seem to accept array|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
            return @mail($to, $subject, $body, /** @scrutinizer ignore-type */ $headers, $extraParams);
Loading history...
45
        }
46
47
        return @mail($to, $subject, $body, $headers);
48
    }
49
}
50