DisposableEmailWrapper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 33
ccs 10
cts 10
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDomain() 0 4 1
A setLocalName() 0 4 1
A process() 0 6 1
A validateDisposableEmail() 0 8 2
1
<?php
2
3
namespace devtoolboxuk\cerberus\Wrappers;
4
5
use devtoolboxuk\lists\ListService;
6
7
class DisposableEmailWrapper extends Base
8
{
9
10 2
    private $domain;
11
12 2
    public function process()
13
    {
14 2
        $this->initWrapper($this->setLocalName());
15 2
16 1
        $this->getDomain();
17 1
        $this->validateDisposableEmail();
18
    }
19 2
20
    private function setLocalName()
21 2
    {
22
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
23 2
        return str_replace('Wrapper', '', $name);
24 2
    }
25
26
    private function getDomain()
27
    {
28
        $email = $this->getReference();
29
        $this->domain = substr($email, strpos($email, '@') + 1);
30
    }
31
32
    private function validateDisposableEmail()
33
    {
34
        $listService = new ListService();
35
36
        if ($listService->findInArray('throwawaydomains', $this->domain)) {
37
            $this->setScore($this->getRealScore());
38
        }
39
        $this->setResult();
40
    }
41
}