Completed
Push — master ( d5cddb...55b940 )
by Ronaldo
01:35
created

Validator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 22
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A emailIsValid() 0 4 1
A checkMxIsValid() 0 4 1
1
<?php
2
3
namespace WSW\Email;
4
5
/**
6
 * Trait Validator
7
 *
8
 * @package WSW\Email
9
 * @author Ronaldo Matos Rodrigues <[email protected]>
10
 */
11
trait Validator
12
{
13
    /**
14
     * @param string $email
15
     *
16
     * @return bool
17
     */
18 9
    protected function emailIsValid($email)
19
    {
20 9
        return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
21
    }
22
23
    /**
24
     * @param string $domain
25
     *
26
     * @return bool
27
     */
28 2
    protected function checkMxIsValid($domain)
29
    {
30 2
        return (bool) checkdnsrr($domain, 'MX');
31
    }
32
}
33