Test Failed
Push — master ( 050b2a...3daed9 )
by Giancarlos
02:53
created

Despatch::getFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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