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