Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.31% covered (success)
92.31%
12 / 13
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationStockInputDevolutionDTO
92.31% covered (success)
92.31%
12 / 13
66.67% covered (warning)
66.67%
2 / 3
3.00
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
7 / 7
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 IntegrationStockInputDevolutionDTO implements DataTransferObjectInterface
9{
10    public int $responsible_id;
11    public int $request_id;
12    public int $stock_io_id;
13    public int $cost_center_id;
14    public int $resource_center_id;
15
16    public function __construct(array $args)
17    {
18        $this->responsible_id     = $args['responsible_id'];
19        $this->request_id         = $args['request_id'];
20        $this->stock_io_id        = $args['stock_io_id'];
21        $this->cost_center_id     = $args['cost_center_id'];
22        $this->resource_center_id = $args['resource_center_id'];
23    }
24
25    public function toArray(): array
26    {
27        return [
28            'responsible_id'     => $this->responsible_id,
29            'request_id'         => $this->request_id,
30            'stock_io_id'        => $this->stock_io_id,
31            'cost_center_id'     => $this->cost_center_id,
32            'resource_center_id' => $this->resource_center_id,
33        ];
34    }
35
36    public static function fromRequest(FormRequest $request): IntegrationStockInputDevolutionDTO
37    {
38        return new self($request->validated());
39    }
40}