Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 55
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationInvoiceItemDTO
0.00% covered (danger)
0.00%
0 / 55
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
2
 fromRequest
0.00% covered (danger)
0.00%
0 / 19
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 IntegrationInvoiceItemDTO implements DataTransferObjectInterface
9{
10    public ?string $codDer;
11    public ?string $codLot;
12    public ?string $codPro;
13    public ?string $cplIpc;
14    public ?string $preUni;
15    public ?string $proFor;
16    public ?string $qtdEst;
17    public ?string $qtdRec;
18    public ?string $seqIpo;
19    public ?string $uniNfc;
20    public ?string $uniMed;
21    public ?string $numOcp;
22    public ?string $oriOcp;
23    public ?string $pesBru;
24    public ?string $pesLiq;
25    public ?string $preBas;
26    public ?string $seqIpc;    
27
28    public function __construct(array $args)
29    {
30        $this->codDer = $args['codDer'] ?? '';
31        $this->codLot = $args['codLot'] ?? '';
32        $this->codPro = $args['codPro'] ?? '';
33        $this->cplIpc = $args['cplIpc'] ?? '';
34        $this->preUni = $args['preUni'] ?? '';
35        $this->proFor = $args['proFor'] ?? '';
36        $this->qtdEst = $args['qtdEst'] ?? '';
37        $this->qtdRec = $args['qtdRec'] ?? '';
38        $this->seqIpo = $args['seqIpo'] ?? '';
39        $this->uniNfc = $args['uniNfc'] ?? '';
40        $this->uniMed = $args['uniMed'] ?? '';
41        $this->numOcp = $args['numOcp'] ?? '';
42        $this->oriOcp = $args['oriOcp'] ?? '';
43        $this->pesBru = $args['pesBru'] ?? '';
44        $this->pesLiq = $args['pesLiq'] ?? '';
45        $this->preBas = $args['preBas'] ?? '';
46        $this->seqIpc = $args['seqIpc'] ?? '';        
47    }
48
49    public function toArray(): array
50    {
51        return [
52            'CODDER' => $this->codDer,
53            'CODLOT' => $this->codLot,
54            'CODPRO' => $this->codPro,
55            'CPLIPC' => $this->cplIpc,
56            'PREUNI' => $this->preUni,
57            'PROFOR' => $this->proFor,
58            'QTDEST' => $this->qtdEst,
59            'QTDREC' => $this->qtdRec,
60            'SEQIPO' => $this->seqIpo,
61            'UNINFC' => $this->uniNfc,
62            'UNIMED' => $this->uniMed,
63            'NUMOCP' => $this->numOcp,
64            'ORIOCP' => $this->oriOcp,
65            'PESBRU' => $this->pesBru,
66            'PESLIQ' => $this->pesLiq,
67            'PREBAS' => $this->preBas,
68            'SEQIPC' => $this->seqIpc,            
69        ];
70    }
71
72    public static function fromRequest(FormRequest $request): IntegrationInvoiceItemDTO
73    {
74        return new self([
75            'codDer' => $request->validated('codDer'),
76            'codLot' => $request->validated('codLot'),
77            'codPro' => $request->validated('codPro'),
78            'cplIpc' => $request->validated('cplIpc'),
79            'preUni' => $request->validated('preUni'),
80            'proFor' => $request->validated('proFor'),
81            'qtdEst' => $request->validated('qtdEst'),
82            'qtdRec' => $request->validated('qtdRec'),
83            'seqIpo' => $request->validated('seqIpo'),
84            'uniNfc' => $request->validated('uniNfc'),
85            'uniMed' => $request->validated('uniMed'),
86            'numOcp' => $request->validated('numOcp'),
87            'oriOcp' => $request->validated('oriOcp'),
88            'pesBru' => $request->validated('pesBru'),
89            'pesLiq' => $request->validated('pesLiq'),
90            'preBas' => $request->validated('preBas'),
91            'seqIpc' => $request->validated('seqIpc'),            
92        ]);
93    }
94
95}