Completed
Branch master (2e2c40)
by Rob
01:16
created

EmailWrapper::setLocalName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace devtoolboxuk\cerberus\Wrappers;
4
5
/**
6
 *
7
 * Detect that an email address is valid
8
 *
9
 * Class EmailWrapper
10
 * @package devtoolboxuk\cerberus\Wrappers
11
 */
12
class EmailWrapper extends Wrapper
13
{
14
15 2
    public function process()
16
    {
17 2
        $this->initWrapper($this->setLocalName());
18
19 2
        $sanitise = $this->soteria->sanitise(true);
20 2
        $sanitise->disinfect($this->getReference(), 'email');
21
22 2
        if (!$sanitise->result()->isValid()) {
23
            $this->setScore($this->getRealScore());
24
            $this->setResult();
25
        }
26 2
    }
27
28 2
    private function setLocalName()
29
    {
30 2
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
31 2
        return str_replace('Wrapper', '', $name);
32
    }
33
34
}