Completed
Pull Request — master (#9)
by Laurent
04:26 queued 02:17
created

CreateOrderCommand   A

Complexity

Total Complexity 19

Size/Duplication

Total Lines 257
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 257
rs 10
c 0
b 0
f 0
wmc 19
lcom 1
cbo 0

19 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 1
A getFirstname() 0 4 1
A getName() 0 4 1
A getZip() 0 4 1
A getTown() 0 4 1
A getState() 0 4 1
A getOrigine() 0 4 1
A getPhone() 0 4 1
A getEmail() 0 4 1
A getTva() 0 4 1
A getNbrPax() 0 4 1
A getRegion() 0 4 1
A getCost() 0 4 1
A getComment() 0 4 1
A hasTVA() 0 3 1
A getCivilityId() 0 4 1
A getLanguage() 0 4 1
A getUserId() 0 4 1
A isCommentPublic() 0 3 1
1
<?php
2
/**
3
 *
4
 */
5
6
require_once __DIR__ . '/CommandInterface.php';
7
8
/**
9
 * @author Laurent De Coninck <[email protected]>
10
 */
11
class CreateOrderCommand implements CommandInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $firstname;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var string
25
     */
26
    private $zip;
27
28
    /**
29
     * @var string
30
     */
31
    private $town;
32
33
    /**
34
     * @var int
35
     */
36
    private $state;
37
38
    /**
39
     * @var int
40
     */
41
    private $origine;
42
43
    /**
44
     * @var string
45
     */
46
    private $phone;
47
48
    /**
49
     * @var string
50
     */
51
    private $email;
52
53
    /**
54
     * @var string
55
     */
56
    private $tva;
57
58
    /**
59
     * @var int
60
     */
61
    private $nbrPax;
62
63
    /**
64
     * @var string
65
     */
66
    private $region;
67
68
    /**
69
     * @var int|float
70
     */
71
    private $cost;
72
73
    /**
74
     * @var string
75
     */
76
    private $comment;
77
78
    /**
79
     * @var int
80
     */
81
    private $civilityId;
82
83
    /**
84
     * @var string
85
     */
86
    private $language;
87
88
    /**
89
     * @var int
90
     */
91
    private $userId;
92
93
    /**
94
     * @var boolean
95
     */
96
    private $publicComment;
97
98
    /**
99
     * Construct the command from the form dto
100
     *
101
     * @param stdClass $form
102
     */
103
    public function __construct(stdClass $form, $userId)
104
    {
105
        $this->name = $form->name;
106
        $this->firstname = $form->firstname;
107
        $this->zip = $form->zip;
108
        $this->town = $form->town;
109
        $this->state = $form->state;
110
        $this->phone = $form->phone;
111
        $this->origine = $form->origine;
112
        $this->email = $form->email;
113
        $this->tva = $form->tva;
114
        $this->nbrPax = $form->nbrPax;
115
        $this->region = $form->region;
116
        $this->cost = $form->cost;
117
        $this->comment = $form->comment;
118
        $this->civilityId = $form->civilityId;
119
        $this->language = $form->language;
120
        $this->userId = $userId;
121
        $this->publicComment = $form->isCommentPublic == 1;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public function getFirstname()
128
    {
129
        return $this->firstname;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    public function getName()
136
    {
137
        return $this->name;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getZip()
144
    {
145
        return $this->zip;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getTown()
152
    {
153
        return $this->town;
154
    }
155
156
    /**
157
     * @return int
158
     */
159
    public function getState()
160
    {
161
        return $this->state;
162
    }
163
164
    /**
165
     * @return int
166
     */
167
    public function getOrigine()
168
    {
169
        return $this->origine;
170
    }
171
172
    /**
173
     * @return string
174
     */
175
    public function getPhone()
176
    {
177
        return $this->phone;
178
    }
179
180
    /**
181
     * @return string
182
     */
183
    public function getEmail()
184
    {
185
        return $this->email;
186
    }
187
188
    /**
189
     * @return string
190
     */
191
    public function getTva()
192
    {
193
        return $this->tva;
194
    }
195
196
    /**
197
     * @return int
198
     */
199
    public function getNbrPax()
200
    {
201
        return $this->nbrPax;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getRegion()
208
    {
209
        return $this->region;
210
    }
211
212
    /**
213
     * @return float|int
214
     */
215
    public function getCost()
216
    {
217
        return $this->cost;
218
    }
219
220
    /**
221
     * @return string
222
     */
223
    public function getComment()
224
    {
225
        return $this->comment;
226
    }
227
228
    /**
229
     * @return boolean
230
     */
231
    public function hasTVA(){
232
        return !empty($this->tva);
233
    }
234
235
    /**
236
     * @return int
237
     */
238
    public function getCivilityId()
239
    {
240
        return $this->civilityId;
241
    }
242
243
    /**
244
     * @return string
245
     */
246
    public function getLanguage()
247
    {
248
        return $this->language;
249
    }
250
251
    /**
252
     * @return int
253
     */
254
    public function getUserId()
255
    {
256
        return $this->userId;
257
    }
258
259
    /**
260
     * @return bool
261
     */
262
    public function isCommentPublic(){
263
        return $this->publicComment;
264
    }
265
266
267
}