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