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