EmailTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 2
c 1
b 0
f 0
dl 0
loc 12
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractDomainFromEmail() 0 3 1
1
<?php
2
3
namespace Mediadevs\Validator\Traits;
4
5
trait EmailTrait
6
{
7
    /**
8
     * Uses regex to extract the domain name + tld from an email address.
9
     *
10
     * @param string $email
11
     *
12
     * @return string
13
     */
14 6
    protected function extractDomainFromEmail(string $email): string
15
    {
16 6
        return substr($email, strpos($email, '@') + 1);
17
    }
18
}
19