Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
94.12% |
16 / 17 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationStockOutputWarehouseDTO | |
94.12% |
16 / 17 |
|
66.67% |
2 / 3 |
3.00 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| fromRequest | |
0.00% |
0 / 1 |
|
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 | class IntegrationStockOutputWarehouseDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public ?string $company_code; |
| 11 | public ?string $branch_code; |
| 12 | public ?string $request_number; |
| 13 | public ?string $cost_center; |
| 14 | public ?string $solicitation_number; |
| 15 | public ?string $request_user; |
| 16 | public ?string $warehouse_code; |
| 17 | |
| 18 | public function __construct(array $args) |
| 19 | { |
| 20 | $this->company_code = $args['company_code'] ?? ''; |
| 21 | $this->branch_code = $args['branch_code'] ?? ''; |
| 22 | $this->request_number = $args['request_number'] ?? ''; |
| 23 | $this->cost_center = $args['cost_center'] ?? ''; |
| 24 | $this->solicitation_number = $args['solicitation_number'] ?? ''; |
| 25 | $this->request_user = $args['request_user'] ?? ''; |
| 26 | $this->warehouse_code = $args['warehouse_code'] ?? ''; |
| 27 | } |
| 28 | |
| 29 | public function toArray(): array |
| 30 | { |
| 31 | return [ |
| 32 | 'company_code' => $this->company_code, |
| 33 | 'branch_code' => $this->branch_code, |
| 34 | 'request_number' => $this->request_number, |
| 35 | 'cost_center' => $this->cost_center, |
| 36 | 'solicitation_number' => $this->solicitation_number, |
| 37 | 'request_user' => $this->request_user, |
| 38 | 'warehouse_code' => $this->warehouse_code, |
| 39 | ]; |
| 40 | } |
| 41 | |
| 42 | public static function fromRequest(FormRequest $request): IntegrationStockOutputWarehouseDTO |
| 43 | { |
| 44 | return new self($request->validated()); |
| 45 | } |
| 46 | } |