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