Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 43
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationPurchaseOrderItemDTO
0.00% covered (danger)
0.00%
0 / 43
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 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 fromRequest
0.00% covered (danger)
0.00%
0 / 15
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 IntegrationPurchaseOrderItemDTO 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 $qtdAbe;
17    public ?string $qtdCan;
18    public ?string $qtdPed;
19    public ?string $qtdRec;
20    public ?string $seqIpo;
21    public ?string $uniFor;
22    public ?string $uniMed;
23
24    public function __construct(array $args)
25    {
26        $this->codDer = $args['codDer'] ?? null;
27        $this->codLot = $args['codLot'] ?? null;
28        $this->codPro = $args['codPro'] ?? null;
29        $this->cplIpc = $args['cplIpc'] ?? null;
30        $this->preUni = $args['preUni'] ?? null;
31        $this->proFor = $args['proFor'] ?? null;
32        $this->qtdAbe = $args['qtdAbe'] ?? null;
33        $this->qtdCan = $args['qtdCan'] ?? null;
34        $this->qtdPed = $args['qtdPed'] ?? null;
35        $this->qtdRec = $args['qtdRec'] ?? null;
36        $this->seqIpo = $args['seqIpo'] ?? null;
37        $this->uniFor = $args['uniFor'] ?? null;
38        $this->uniMed = $args['uniMed'] ?? null;
39    }
40
41    public function toArray(): array
42    {
43        return [
44            'CODDER' => $this->codDer,
45            'CODLOT' => $this->codLot,
46            'CODPRO' => $this->codPro,
47            'CPLIPC' => $this->cplIpc,
48            'PREUNI' => $this->preUni,
49            'PROFOR' => $this->proFor,
50            'QTDABE' => $this->qtdAbe,
51            'QTDCAN' => $this->qtdCan,
52            'QTDPED' => $this->qtdPed,
53            'QTDREC' => $this->qtdRec,
54            'SEQIPO' => $this->seqIpo,
55            'UNIFOR' => $this->uniFor,
56            'UNIMED' => $this->uniMed,
57        ];
58    }
59
60    public static function fromRequest(FormRequest $request): IntegrationPurchaseOrderItemDTO
61    {
62        return new self([
63            'codDer' => $request->validated('codDer'),
64            'codLot' => $request->validated('codLot'),
65            'codPro' => $request->validated('codPro'),
66            'cplIpc' => $request->validated('cplIpc'),
67            'preUni' => $request->validated('preUni'),
68            'proFor' => $request->validated('proFor'),
69            'qtdAbe' => $request->validated('qtdAbe'),
70            'qtdCan' => $request->validated('qtdCan'),
71            'qtdPed' => $request->validated('qtdPed'),
72            'qtdRec' => $request->validated('qtdRec'),
73            'seqIpo' => $request->validated('seqIpo'),
74            'uniFor' => $request->validated('uniFor'),
75            'uniMed' => $request->validated('uniMed'),
76        ]);
77    }
78
79}