DisposableEmailWrapper::setLocalName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
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
}