Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
98.36% covered (success)
98.36%
60 / 61
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationStockInputDTO
98.36% covered (success)
98.36%
60 / 61
66.67% covered (warning)
66.67%
2 / 3
3
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
29 / 29
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
1
 fromRequest
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\Integration\DTOs;
4
5use Domain\Shared\Interfaces\DataTransferObjectInterface;
6use Illuminate\Foundation\Http\FormRequest;
7
8class IntegrationStockInputDTO implements DataTransferObjectInterface
9{
10
11    public int $productionOrder;
12    public int $CODEMP;
13    public string $CODPRO;
14    public string $CODDER;
15    public string $CODDEP;
16    public string $DATMOV;
17    public int $SEQMOV;
18    public string $UNIMED;
19    public ?string $DESDEP;
20    public ?string $DESPRO;
21    public ?string $DESDER;
22    public ?string $CODFAM;
23    public ?string $CODORI;
24    public ?int $FILDEP;
25    public ?string $CODTNS;
26    public ?string $ESTMOV;
27    public ?string $ESTEOS;
28    public ?string $ORIORP;
29    public ?int $NUMDOC;
30    public ?int $QTDMOV;
31    public ?int $CODFIL;
32    public ?int $QTDEST;
33    public ?int $QTDBLO;
34    public ?int $QTDRES;
35    public ?int $QTDRAE;
36    public ?int $QTDORD;
37    public ?int $QTDCCL;
38    public ?int $QTDCFO;
39    public ?string $DESTNS;
40
41    public function __construct(array $args)
42    {
43        $this->productionOrder = $args['production_order'];
44        $this->CODEMP = $args['E210MVP_CODEMP'];
45        $this->CODPRO = $args['E210MVP_CODPRO'];
46        $this->CODDER = $args['E210MVP_CODDER'];
47        $this->CODDEP = $args['E210MVP_CODDEP'];
48        $this->DATMOV = $args['E210MVP_DATMOV'];
49        $this->SEQMOV = $args['E210MVP_SEQMOV'];
50        $this->UNIMED = $args['E210EST_UNIMED'];
51        $this->DESDEP = $args['E205DEP_DESDEP'] ?? null;
52        $this->DESPRO = $args['E075PRO_DESPRO'] ?? null;
53        $this->DESDER = $args['E075DER_DESDER'] ?? null;
54        $this->CODFAM = $args['E075PRO_CODFAM'] ?? null;
55        $this->CODORI = $args['E075PRO_CODORI'] ?? null;
56        $this->FILDEP = $args['E210MVP_FILDEP'] ?? null;
57        $this->CODTNS = $args['E210MVP_CODTNS'] ?? null;
58        $this->ESTMOV = $args['E210MVP_ESTMOV'] ?? null;
59        $this->ESTEOS = $args['E210MVP_ESTEOS'] ?? null;
60        $this->ORIORP = $args['E210MVP_ORIORP'] ?? null;
61        $this->NUMDOC = $args['E210MVP_NUMDOC'] ?? null;
62        $this->QTDMOV = $args['E210MVP_QTDMOV'] ?? null;
63        $this->CODFIL = $args['E205DEP_CODFIL'] ?? null;
64        $this->QTDEST = $args['E210EST_QTDEST'] ?? null;
65        $this->QTDBLO = $args['E210EST_QTDBLO'] ?? null;
66        $this->QTDRES = $args['E210EST_QTDRES'] ?? null;
67        $this->QTDRAE = $args['E210EST_QTDRAE'] ?? null;
68        $this->QTDORD = $args['E210EST_QTDORD'] ?? null;
69        $this->QTDCCL = $args['E210EST_QTDCCL'] ?? null;
70        $this->QTDCFO = $args['E210EST_QTDCFO'] ?? null;
71        $this->DESTNS = $args['E001TNS_DESTNS'] ?? null;
72    }
73
74    public function toArray(): array
75    {
76        return [
77            'production_order' => $this->productionOrder,
78            'CODEMP' => $this->CODEMP,
79            'CODPRO' => $this->CODPRO,
80            'CODDER' => $this->CODDER,
81            'CODDEP' => $this->CODDEP,
82            'DATMOV' => $this->DATMOV,
83            'SEQMOV' => $this->SEQMOV,
84            'UNIMED' => $this->UNIMED,
85            'DESDEP' => $this->DESDEP,
86            'DESPRO' => $this->DESPRO,
87            'DESDER' => $this->DESDER,
88            'CODFAM' => $this->CODFAM,
89            'CODORI' => $this->CODORI,
90            'FILDEP' => $this->FILDEP,
91            'CODTNS' => $this->CODTNS,
92            'ESTMOV' => $this->ESTMOV,
93            'ESTEOS' => $this->ESTEOS,
94            'ORIORP' => $this->ORIORP,
95            'NUMDOC' => $this->NUMDOC,
96            'QTDMOV' => $this->QTDMOV,
97            'CODFIL' => $this->CODFIL,
98            'QTDEST' => $this->QTDEST,
99            'QTDBLO' => $this->QTDBLO,
100            'QTDRES' => $this->QTDRES,
101            'QTDRAE' => $this->QTDRAE,
102            'QTDORD' => $this->QTDORD,
103            'QTDCCL' => $this->QTDCCL,
104            'QTDCFO' => $this->QTDCFO,
105            'DESTNS' => $this->DESTNS,
106        ];
107    }
108
109    public static function fromRequest(FormRequest $request): IntegrationStockInputDTO
110    {
111        return new self($request->validated());
112    }
113}