Completed
Push — remove-content-bundle ( c91180...63aea7 )
by Kamil
20:12
created

Email::enable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Mailer\Model;
13
14
use Sylius\Component\Resource\Model\TimestampableTrait;
15
use Sylius\Component\Resource\Model\ToggleableTrait;
16
17
/**
18
 * @author Paweł Jędrzejewski <[email protected]>
19
 */
20
class Email implements EmailInterface
21
{
22
    /**
23
     * @var mixed
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     */
30
    protected $code;
31
32
    /**
33
     * @var bool
34
     */
35
    protected $enabled = true;
36
37
    /**
38
     * @var string
39
     */
40
    protected $subject;
41
42
    /**
43
     * @var string
44
     */
45
    protected $content;
46
47
    /**
48
     * @var string
49
     */
50
    protected $template;
51
52
    /**
53
     * @var string
54
     */
55
    protected $senderName;
56
57
    /**
58
     * @var string
59
     */
60
    protected $senderAddress;
61
62
    public function __construct()
63
    {
64
        $this->createdAt = new \DateTime();
0 ignored issues
show
Bug introduced by
The property createdAt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function getId()
71
    {
72
        return $this->id;
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function getCode()
79
    {
80
        return $this->code;
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function setCode($code)
87
    {
88
        $this->code = $code;
89
    }
90
91
    /**
92
     * @return bool
93
     */
94
    public function isEnabled()
95
    {
96
        return $this->enabled;
97
    }
98
99
    /**
100
     * @param bool $enabled
101
     */
102
    public function setEnabled($enabled)
103
    {
104
        $this->enabled = (bool) $enabled;
105
    }
106
107
    public function enable()
108
    {
109
        $this->enabled = true;
110
    }
111
112
    public function disable()
113
    {
114
        $this->enabled = false;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function getSubject()
121
    {
122
        return $this->subject;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function setSubject($subject)
129
    {
130
        $this->subject = $subject;
131
    }
132
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function getContent()
137
    {
138
        return $this->content;
139
    }
140
141
    /**
142
     * {@inheritdoc}
143
     */
144
    public function setContent($content)
145
    {
146
        $this->content = $content;
147
    }
148
149
    /**
150
     * {@inheritdoc}
151
     */
152
    public function getTemplate()
153
    {
154
        return $this->template;
155
    }
156
157
    /**
158
     * {@inheritdoc}
159
     */
160
    public function setTemplate($template)
161
    {
162
        $this->template = $template;
163
    }
164
165
    /**
166
     * {@inheritdoc}
167
     */
168
    public function getSenderName()
169
    {
170
        return $this->senderName;
171
    }
172
173
    /**
174
     * {@inheritdoc}
175
     */
176
    public function setSenderName($senderName)
177
    {
178
        $this->senderName = $senderName;
179
    }
180
181
    /**
182
     * {@inheritdoc}
183
     */
184
    public function getSenderAddress()
185
    {
186
        return $this->senderAddress;
187
    }
188
189
    /**
190
     * {@inheritdoc}
191
     */
192
    public function setSenderAddress($senderAddress)
193
    {
194
        $this->senderAddress = $senderAddress;
195
    }
196
}
197