Passed
Branch master (a43e58)
by Giancarlos
04:04
created

Despatch::setDetails()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 07/08/2017
6
 * Time: 21:42
7
 */
8
9
namespace Greenter\Model\Despatch;
10
11
use Greenter\Model\Client\Client;
12
use Greenter\Model\Company\Company;
13
use Greenter\Model\Sale\Document;
14
use Greenter\Xml\Validator\DespatchValidator;
15
use Symfony\Component\Validator\Constraints as Assert;
16
17
/**
18
 * Class Despatch
19
 * @package Greenter\Model\Despatch
20
 */
21
class Despatch
22
{
23
    use DespatchValidator;
24
25
    /**
26
     * @Assert\NotBlank()
27
     * @Assert\Length(max="2")
28
     * @var string
29
     */
30
    private $tipoDoc;
31
32
    /**
33
     * Serie del Documento (ejem: T001)
34
     *
35
     * @Assert\NotBlank()
36
     * @Assert\Length(max="4")
37
     * @var string
38
     */
39
    private $serie;
40
41
    /**
42
     * @Assert\NotBlank()
43
     * @Assert\Length(max="8")
44
     * @var string
45
     */
46
    private $correlativo;
47
48
    /**
49
     * @Assert\Length(max="250")
50
     * @var string
51
     */
52
    private $observacion;
53
    /**
54
     * @Assert\Date()
55
     * @var \DateTime
56
     */
57
    private $fechaEmision;
58
59
    /**
60
     * @Assert\NotBlank()
61
     * @Assert\Valid()
62
     * @var Company
63
     */
64
    private $company;
65
66
    /**
67
     * @Assert\NotBlank()
68
     * @Assert\Valid()
69
     * @var Client
70
     */
71
    private $destinatario;
72
73
    /**
74
     * Datos del Establecimiento del tercero (cuando se ingrese)
75
     *
76
     * @Assert\Valid()
77
     * @var Client
78
     */
79
    private $tercero;
80
81
    /**
82
     * @Assert\NotBlank()
83
     * @Assert\Valid()
84
     * @var Shipment
85
     */
86
    private $envio;
87
88
    /**
89
     * @Assert\Valid()
90
     * @var Document
91
     */
92
    private $docBaja;
93
94
    /**
95
     * @Assert\Valid()
96
     * @var Document
97
     */
98
    private $relDoc;
99
100
    /**
101
     * @Assert\NotBlank()
102
     * @Assert\Valid()
103
     * @var DespatchDetail[]
104
     */
105
    private $details;
106
107
    /**
108
     * @return string
109
     */
110 6
    public function getTipoDoc()
111
    {
112 6
        return $this->tipoDoc;
113
    }
114
115
    /**
116
     * @param string $tipoDoc
117
     * @return Despatch
118
     */
119 12
    public function setTipoDoc($tipoDoc)
120
    {
121 12
        $this->tipoDoc = $tipoDoc;
122 12
        return $this;
123
    }
124
125
    /**
126
     * @return string
127
     */
128 6
    public function getSerie()
129
    {
130 6
        return $this->serie;
131
    }
132
133
    /**
134
     * @param string $serie
135
     * @return Despatch
136
     */
137 12
    public function setSerie($serie)
138
    {
139 12
        $this->serie = $serie;
140 12
        return $this;
141
    }
142
143
    /**
144
     * @return string
145
     */
146 6
    public function getCorrelativo()
147
    {
148 6
        return $this->correlativo;
149
    }
150
151
    /**
152
     * @param string $correlativo
153
     * @return Despatch
154
     */
155 12
    public function setCorrelativo($correlativo)
156
    {
157 12
        $this->correlativo = $correlativo;
158 12
        return $this;
159
    }
160
161
    /**
162
     * @return string
163
     */
164 4
    public function getObservacion()
165
    {
166 4
        return $this->observacion;
167
    }
168
169
    /**
170
     * @param string $observacion
171
     * @return Despatch
172
     */
173 12
    public function setObservacion($observacion)
174
    {
175 12
        $this->observacion = $observacion;
176 12
        return $this;
177
    }
178
179
    /**
180
     * @return \DateTime
181
     */
182 4
    public function getFechaEmision()
183
    {
184 4
        return $this->fechaEmision;
185
    }
186
187
    /**
188
     * @param \DateTime $fechaEmision
189
     * @return Despatch
190
     */
191 12
    public function setFechaEmision($fechaEmision)
192
    {
193 12
        $this->fechaEmision = $fechaEmision;
194 12
        return $this;
195
    }
196
197
    /**
198
     * @return Company
199
     */
200 6
    public function getCompany()
201
    {
202 6
        return $this->company;
203
    }
204
205
    /**
206
     * @param Company $company
207
     * @return Despatch
208
     */
209 12
    public function setCompany($company)
210
    {
211 12
        $this->company = $company;
212 12
        return $this;
213
    }
214
215
    /**
216
     * @return Client
217
     */
218 4
    public function getDestinatario()
219
    {
220 4
        return $this->destinatario;
221
    }
222
223
    /**
224
     * @param Client $destinatario
225
     * @return Despatch
226
     */
227 12
    public function setDestinatario($destinatario)
228
    {
229 12
        $this->destinatario = $destinatario;
230 12
        return $this;
231
    }
232
233
    /**
234
     * @return Client
235
     */
236 4
    public function getTercero()
237
    {
238 4
        return $this->tercero;
239
    }
240
241
    /**
242
     * @param Client $tercero
243
     * @return Despatch
244
     */
245 12
    public function setTercero($tercero)
246
    {
247 12
        $this->tercero = $tercero;
248 12
        return $this;
249
    }
250
251
    /**
252
     * @return Shipment
253
     */
254 4
    public function getEnvio()
255
    {
256 4
        return $this->envio;
257
    }
258
259
    /**
260
     * @param Shipment $envio
261
     * @return Despatch
262
     */
263 12
    public function setEnvio($envio)
264
    {
265 12
        $this->envio = $envio;
266 12
        return $this;
267
    }
268
269
    /**
270
     * @return Document
271
     */
272 4
    public function getDocBaja()
273
    {
274 4
        return $this->docBaja;
275
    }
276
277
    /**
278
     * @param Document $docBaja
279
     * @return Despatch
280
     */
281 12
    public function setDocBaja($docBaja)
282
    {
283 12
        $this->docBaja = $docBaja;
284 12
        return $this;
285
    }
286
287
    /**
288
     * @return Document
289
     */
290 4
    public function getRelDoc()
291
    {
292 4
        return $this->relDoc;
293
    }
294
295
    /**
296
     * @param Document $relDoc
297
     * @return Despatch
298
     */
299 12
    public function setRelDoc($relDoc)
300
    {
301 12
        $this->relDoc = $relDoc;
302 12
        return $this;
303
    }
304
305
    /**
306
     * @return DespatchDetail[]
307
     */
308 4
    public function getDetails()
309
    {
310 4
        return $this->details;
311
    }
312
313
    /**
314
     * @param DespatchDetail[] $details
315
     * @return Despatch
316
     */
317 12
    public function setDetails($details)
318
    {
319 12
        $this->details = $details;
320 12
        return $this;
321
    }
322
323
    /**
324
     * Get FileName without extension.
325
     *
326
     * @return string
327
     */
328 4 View Code Duplication
    public function getFileName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
329
    {
330
        $parts = [
331 4
            $this->company->getRuc(),
332 4
            $this->getTipoDoc(), // 09
333 4
            $this->getSerie(),
334 4
            $this->getCorrelativo(),
335 4
        ];
336
337 4
        return join('-', $parts);
338
    }
339
}