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