Completed
Push — master ( 20d8fe...40dd32 )
by Harald
09:20 queued 04:54
created

email   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B execute() 0 18 8
1
<?php
2
/**
3
  * osCommerce Online Merchant
4
  *
5
  * @copyright (c) 2016 osCommerce; https://www.oscommerce.com
6
  * @license GPL; https://www.oscommerce.com/gpllicense.txt
7
  */
8
9
namespace OSC\OM\Is;
10
11
class email
12
{
13
    public static function execute($email, $disable_dns_check = false)
14
    {
15
        $email = trim($email);
16
17
        if (!empty($email) && (strlen($email) <= 255) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
18
            if (($disable_dns_check === false) && (ENTRY_EMAIL_ADDRESS_CHECK == 'true')) {
19
                $domain = explode('@', $email);
20
21
                if (!checkdnsrr($domain[1], 'MX') && !checkdnsrr($domain[1], 'A')) {
22
                    return false;
23
                }
24
            }
25
26
            return true;
27
        }
28
29
        return false;
30
    }
31
}
32