Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
ItemGetMovementDateDTO
0.00% covered (danger)
0.00%
0 / 16
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 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
 fromRequest
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\Item\DTOs;
4
5use Domain\Shared\Interfaces\DataTransferObjectInterface;
6use Illuminate\Foundation\Http\FormRequest;
7
8readonly final class ItemGetMovementDateDTO implements DataTransferObjectInterface
9{
10
11    public ?string $integrationProduct;
12    public ?string $integrationDerivation;
13    public ?string $productionOrder;
14    public ?string $integrationCode;
15
16    public function __construct(array $args)
17    {
18        $this->productionOrder = $args['production_order'];
19        $this->integrationProduct = $args['integration_product'];
20        $this->integrationDerivation = $args['integration_derivation'];
21        $this->integrationCode = $args['integration_code'];
22    }
23
24    public function toArray(): array
25    {
26        return [
27            'integration_product' => $this->integrationProduct,
28            'integration_derivation' => $this->integrationDerivation,
29            'production_order' => $this->productionOrder,
30            'integration_code' => $this->integrationCode,
31        ];
32    }
33
34    public static function fromRequest(FormRequest $request): ItemGetMovementDateDTO
35    {
36        return new self([
37            'integration_product' => $request->validated('integration_product'),
38            'integration_derivation' => $request->validated('integration_derivation'),
39            'production_order' => $request->validated('production_order'),
40            'integration_code' => $request->validated('integration_code'),
41        ]);
42    }
43}