Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
60.00% covered (warning)
60.00%
6 / 10
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationItemDTO
60.00% covered (warning)
60.00%
6 / 10
66.67% covered (warning)
66.67%
2 / 3
3.58
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 fromRequest
0.00% covered (danger)
0.00%
0 / 4
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 IntegrationItemDTO implements DataTransferObjectInterface
9{
10    public ?string $productionOrder;
11    public ?string $movementDate;
12
13
14    public function __construct(array $args)
15    {
16        $this->productionOrder = $args['production_order'] ?? null;
17        $this->movementDate = $args['movement_date'] ?? null;
18    }
19
20    public function toArray(): array
21    {
22        return [
23            'production_order' => $this->productionOrder,
24            'movement_date'    => $this->movementDate,
25        ];
26    }
27
28    public static function fromRequest(FormRequest $request): IntegrationItemDTO
29    {
30        return new self([
31            'production_order' => $request->validated('production_order'),
32            'movement_date'    => $request->validated('movement_date'),
33        ]);
34    }
35
36}