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