User   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getEmail() 0 3 1
A getEmailName() 0 3 1
A sanitize() 0 5 1
A setData() 0 5 1
1
<?php
2
3
namespace kalanis\EmailApi\Basics;
4
5
6
use kalanis\EmailApi\Interfaces;
7
8
9
/**
10
 * Class User
11
 * @package kalanis\EmailApi\Interfaces
12
 * Simple implementation of user which sends the emails
13
 */
14
class User implements Interfaces\IEmailUser
15
{
16
    public string $email = '';
17
    public string $name = '';
18
19 15
    public function setData(string $email, string $name = ''): self
20
    {
21 15
        $this->name = $name;
22 15
        $this->email = $email;
23 15
        return $this;
24
    }
25
26 1
    public function sanitize(): self
27
    {
28 1
        $this->name = strval($this->name);
29 1
        $this->email = strval($this->email);
30 1
        return $this;
31
    }
32
33 3
    public function getEmail(): string
34
    {
35 3
        return $this->email;
36
    }
37
38 1
    public function getEmailName(): string
39
    {
40 1
        return $this->name;
41
    }
42
}
43