Passed
Push — master ( bf42cc...349842 )
by Peter
05:57
created

Form::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Contact\Domain\Entities;
6
7
use AbterPhp\Framework\Domain\Entities\IStringerEntity;
8
9
class Form implements IStringerEntity
10
{
11
    /** @var string */
12
    protected $id;
13
14
    /** @var string */
15
    protected $name;
16
17
    /** @var string */
18
    protected $identifier;
19
20
    /** @var string */
21
    protected $toName;
22
23
    /** @var string */
24
    protected $toEmail;
25
26
    /**
27
     * @param string $id
28
     * @param string $name
29
     * @param string $identifier
30
     * @param string $toName
31
     * @param string $toEmail
32
     */
33
    public function __construct(string $id, string $name, string $identifier, string $toName, string $toEmail)
34
    {
35
        $this->id         = $id;
36
        $this->name       = $name;
37
        $this->identifier = $identifier;
38
        $this->toName     = $toName;
39
        $this->toEmail    = $toEmail;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getId()
46
    {
47
        return $this->id;
48
    }
49
50
    /**
51
     * @param string $id
52
     */
53
    public function setId($id)
54
    {
55
        $this->id = $id;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getIdentifier(): string
62
    {
63
        return $this->identifier;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getName(): string
70
    {
71
        return $this->name;
72
    }
73
74
    /**
75
     * @param string $name
76
     *
77
     * @return $this
78
     */
79
    public function setName(string $name): Form
80
    {
81
        $this->name = $name;
82
83
        return $this;
84
    }
85
86
    /**
87
     * @param string $identifier
88
     *
89
     * @return $this
90
     */
91
    public function setIdentifier(string $identifier): Form
92
    {
93
        $this->identifier = $identifier;
94
95
        return $this;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getToName(): string
102
    {
103
        return $this->toName;
104
    }
105
106
    /**
107
     * @param string $toName
108
     *
109
     * @return $this
110
     */
111
    public function setToName(string $toName): Form
112
    {
113
        $this->toName = $toName;
114
115
        return $this;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getToEmail(): string
122
    {
123
        return $this->toEmail;
124
    }
125
126
    /**
127
     * @param string $toEmail
128
     *
129
     * @return $this
130
     */
131
    public function setToEmail(string $toEmail): Form
132
    {
133
        $this->toEmail = $toEmail;
134
135
        return $this;
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function __toString(): string
142
    {
143
        return $this->getIdentifier();
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function toJSON(): string
150
    {
151
        return json_encode(
152
            [
153
                'id'         => $this->getId(),
154
                'name'       => $this->getName(),
155
                'identifier' => $this->getIdentifier(),
156
                'to_name'    => $this->getToName(),
157
                'to_email'   => $this->getToEmail(),
158
            ]
159
        );
160
    }
161
}
162