FormObject   A
last analyzed

Complexity

Total Complexity 18

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 0
dl 0
loc 117
rs 10
c 0
b 0
f 0

16 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 6 1
A setId() 0 6 1
A getId() 0 4 1
A setEmail() 0 6 1
A getEmail() 0 4 1
A setPassword() 0 6 1
A getPassword() 0 4 1
A setUsername() 0 6 1
A getUsername() 0 4 1
A setFirstname() 0 6 1
A getFirstname() 0 4 1
A setSurname() 0 6 1
A getSurname() 0 4 1
A getName() 0 4 3
A getOptgroup() 0 4 1
A setOptgroup() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest\Form\Element\TestAsset;
6
7
use function assert;
8
9
/**
10
 * Simple mock object for form element adapter tests
11
 *
12
 * @link    http://www.doctrine-project.org/
13
 */
14
class FormObject
15
{
16
    /** @var int|null */
17
    protected $id;
18
19
    /** @var string|null */
20
    public $email;
21
22
    /** @var string|null */
23
    protected $username;
24
25
    /** @var string|null */
26
    protected $firstname;
27
28
    /** @var string|null */
29
    protected $surname;
30
31
    /** @var string|null */
32
    protected $password;
33
34
    /** @var string|null */
35
    protected $optgroup;
36
37
    public function __toString() : string
38
    {
39
        assert($this->username !== null);
40
41
        return $this->username;
42
    }
43
44
    public function setId(int $id) : self
45
    {
46
        $this->id = (int) $id;
47
48
        return $this;
49
    }
50
51
    public function getId() : ?int
52
    {
53
        return $this->id;
54
    }
55
56
    public function setEmail(string $email) : self
57
    {
58
        $this->email = (string) $email;
59
60
        return $this;
61
    }
62
63
    public function getEmail() : ?string
64
    {
65
        return $this->email;
66
    }
67
68
    public function setPassword(string $password) : self
69
    {
70
        $this->password = (string) $password;
71
72
        return $this;
73
    }
74
75
    public function getPassword() : ?string
76
    {
77
        return $this->password;
78
    }
79
80
    public function setUsername(string $username) : self
81
    {
82
        $this->username = (string) $username;
83
84
        return $this;
85
    }
86
87
    public function getUsername() : ?string
88
    {
89
        return $this->username;
90
    }
91
92
    public function setFirstname(string $firstname) : self
93
    {
94
        $this->firstname = (string) $firstname;
95
96
        return $this;
97
    }
98
99
    public function getFirstname() : ?string
100
    {
101
        return $this->firstname;
102
    }
103
104
    public function setSurname(string $surname) : self
105
    {
106
        $this->surname = (string) $surname;
107
108
        return $this;
109
    }
110
111
    public function getSurname() : ?string
112
    {
113
        return $this->surname;
114
    }
115
116
    public function getName() : ?string
117
    {
118
        return isset($this->firstname) && isset($this->surname) ? $this->firstname . ' ' . $this->surname : null;
119
    }
120
121
    public function getOptgroup() : ?string
122
    {
123
        return $this->optgroup;
124
    }
125
126
    public function setOptgroup(?string $optgroup) : void
127
    {
128
        $this->optgroup = $optgroup;
129
    }
130
}
131