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