Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
64.29% covered (warning)
64.29%
18 / 28
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationStockOutputProductDTO
64.29% covered (warning)
64.29%
18 / 28
66.67% covered (warning)
66.67%
2 / 3
3.41
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
 fromRequest
0.00% covered (danger)
0.00%
0 / 10
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
8readonly final class IntegrationStockOutputProductDTO implements DataTransferObjectInterface
9{
10    public ?string $SEQPES;
11    public ?string $PESLIQ;
12    public ?string $PESBRU;
13    public ?string $PEDCLI;
14    public ?string $PROCLI;
15    public ?string $EMICER;
16    public ?string $NUMPED;
17    public ?string $SEQIPD;
18
19
20    public function __construct(array $args)
21    {
22        $this->SEQPES = $args['E135PES_SEQPES'] ?? "";
23        $this->PESLIQ = $args['E135PES_PESLIQ'] ?? "";
24        $this->PESBRU = $args['E135PES_PESBRU'] ?? "";
25        $this->PEDCLI = $args['E120PED_PEDCLI'] ?? "";
26        $this->PROCLI = $args['E075PPC_PROCLI'] ?? "";
27        $this->EMICER = $args['E120IPD_EMICER'] ?? "";
28        $this->NUMPED = $args['E135PES_NUMPED'] ?? "";
29        $this->SEQIPD = $args['E135PES_SEQIPD'] ?? "";
30    }
31
32    public function toArray(): array
33    {
34        return [
35            'SEQPES' => $this->SEQPES,
36            'PESLIQ' => $this->PESLIQ,
37            'PESBRU' => $this->PESBRU,
38            'PEDCLI' => $this->PEDCLI,
39            'PROCLI' => $this->PROCLI,
40            'EMICER' => $this->EMICER,
41            'NUMPED' => $this->NUMPED,
42            'SEQIPD' => $this->SEQIPD,
43        ];
44    }
45
46    public static function fromRequest(FormRequest $request): IntegrationStockOutputProductDTO
47    {
48        return new self([
49            'E135PES_SEQPES' => $request->validated('E135PES_SEQPES'),
50            'E135PES_PESLIQ' => $request->validated('E135PES_PESLIQ'),
51            'E135PES_PESBRU' => $request->validated('E135PES_PESBRU'),
52            'E120PED_PEDCLI' => $request->validated('E120PED_PEDCLI'),
53            'E075PPC_PROCLI' => $request->validated('E075PPC_PROCLI'),
54            'E120IPD_EMICER' => $request->validated('E120IPD_EMICER'),
55            'E135PES_NUMPED' => $request->validated('E135PES_NUMPED'),
56            'E135PES_SEQIPD' => $request->validated('E135PES_SEQIPD'),
57        ]);
58    }
59}