Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.77% covered (success)
96.77%
30 / 31
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationStockInputWarehouseDTO
96.77% covered (success)
96.77%
30 / 31
66.67% covered (warning)
66.67%
2 / 3
3
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
1
 fromRequest
0.00% covered (danger)
0.00%
0 / 1
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 IntegrationStockInputWarehouseDTO implements DataTransferObjectInterface
9{
10
11    public string $invoice_key;
12    public string $warehouse_code;
13    public string $derivation_code;
14    public string $company_code;
15    public string $product_code;
16    public string $supplier_code;
17    public string $date_movement;
18    public string $warehouse_branch;
19    public string $invoice_branch;
20    public string $invoice_number;
21    public string $quantity_movement;
22    public string $sequence_movement;
23    public string $sequence_register;
24    public string $invoice_series;
25
26    public function __construct(array $args)
27    {
28        $this->invoice_key       = $args['invoice_key'];
29        $this->warehouse_code    = $args['warehouse_code'];
30        $this->derivation_code   = $args['derivation_code'];
31        $this->company_code      = $args['company_code'];
32        $this->product_code      = $args['product_code'];
33        $this->supplier_code     = $args['supplier_code'];
34        $this->date_movement     = $args['date_movement'];
35        $this->warehouse_branch  = $args['warehouse_branch'];
36        $this->invoice_branch    = $args['invoice_branch'];
37        $this->invoice_number    = $args['invoice_number'];
38        $this->quantity_movement = $args['quantity_movement'];
39        $this->sequence_movement = $args['sequence_movement'];
40        $this->sequence_register = $args['sequence_register'];
41        $this->invoice_series    = $args['invoice_series'];
42    }
43
44    public function toArray(): array
45    {
46        return [
47            'invoice_key'       => $this->invoice_key,
48            'warehouse_code'    => $this->warehouse_code,
49            'derivation_code'   => $this->derivation_code,
50            'company_code'      => $this->company_code,
51            'product_code'      => $this->product_code,
52            'supplier_code'     => $this->supplier_code,
53            'date_movement'     => $this->date_movement,
54            'warehouse_branch'  => $this->warehouse_branch,
55            'invoice_branch'    => $this->invoice_branch,
56            'invoice_number'    => $this->invoice_number,
57            'quantity_movement' => $this->quantity_movement,
58            'sequence_movement' => $this->sequence_movement,
59            'sequence_register' => $this->sequence_register,
60            'invoice_series'    => $this->invoice_series,
61        ];
62    }
63
64    public static function fromRequest(FormRequest $request): IntegrationStockInputWarehouseDTO
65    {
66        return new self($request->validated());
67    }
68}