Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationPackagingDTO | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| fromRequest | |
0.00% |
0 / 7 |
|
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 IntegrationPackagingDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public int $codemp; |
| 11 | public int $codemb; |
| 12 | public string $desemb; |
| 13 | public string $abremb; |
| 14 | public string $embexp; |
| 15 | |
| 16 | public function __construct(array $args) |
| 17 | { |
| 18 | $this->codemp = $args['CODEMP']; |
| 19 | $this->codemb = $args['CODEMB']; |
| 20 | $this->desemb = $args['DESEMB']; |
| 21 | $this->abremb = $args['ABREMB']; |
| 22 | $this->embexp = $args['EMBEXP']; |
| 23 | } |
| 24 | |
| 25 | public function toArray(): array |
| 26 | { |
| 27 | return [ |
| 28 | 'CODEMP' => $this->codemp, |
| 29 | 'CODEMB' => $this->codemb, |
| 30 | 'DESEMB' => $this->desemb, |
| 31 | 'ABREMB' => $this->abremb, |
| 32 | 'EMBEXP' => $this->embexp, |
| 33 | ]; |
| 34 | } |
| 35 | |
| 36 | public static function fromRequest(FormRequest $request): IntegrationPackagingDTO |
| 37 | { |
| 38 | return new self([ |
| 39 | 'CODEMP' => $request->validated('codemp'), |
| 40 | 'CODEMB' => $request->validated('codemb'), |
| 41 | 'DESEMB' => $request->validated('desemb'), |
| 42 | 'abremb' => $request->validated('abremb'), |
| 43 | 'embexp' => $request->validated('embexp'), |
| 44 | ]); |
| 45 | } |
| 46 | |
| 47 | } |