Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
61.54% |
8 / 13 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationStockInputProductDTO | |
61.54% |
8 / 13 |
|
66.67% |
2 / 3 |
3.51 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| fromRequest | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Integration\DTOs; |
| 4 | |
| 5 | use Domain\Shared\Interfaces\DataTransferObjectInterface; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | readonly final class IntegrationStockInputProductDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public ?string $SEQMOV; |
| 11 | public ?string $NUMDOC; |
| 12 | public ?string $DATMOV; |
| 13 | |
| 14 | |
| 15 | public function __construct(array $args) |
| 16 | { |
| 17 | $this->SEQMOV = $args['E210MVP_SEQMOV'] ?? null; |
| 18 | $this->NUMDOC = $args['E210MVP_NUMDOC'] ?? null; |
| 19 | $this->DATMOV = $args['E210MVP_DATMOV'] ?? null; |
| 20 | |
| 21 | } |
| 22 | |
| 23 | public function toArray(): array |
| 24 | { |
| 25 | return [ |
| 26 | 'SEQMOV' => $this->SEQMOV, |
| 27 | 'NUMDOC' => $this->NUMDOC, |
| 28 | 'DATMOV' => $this->DATMOV, |
| 29 | ]; |
| 30 | } |
| 31 | |
| 32 | public static function fromRequest(FormRequest $request): IntegrationStockInputProductDTO |
| 33 | { |
| 34 | return new self([ |
| 35 | 'E210MVP_SEQMOV' => $request->validated('SEQMOV'), |
| 36 | 'E210MVP_NUMDOC' => $request->validated('NUMDOC'), |
| 37 | 'E210MVP_DATMOV' => $request->validated('DATMOV'), |
| 38 | ]); |
| 39 | } |
| 40 | |
| 41 | } |