Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TransferableStoreService
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 store
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Domain\Transferable\Services;
4
5use App\Models\Transferable\Transferable;
6use Domain\Item\Interfaces\HasTransferableInterface;
7
8readonly class TransferableStoreService
9{
10    /**
11     * @param HasTransferableInterface $transferable
12     * @return Transferable
13     */
14    public function store(HasTransferableInterface $transferable): Transferable
15    {
16        return Transferable::create([
17            'transferable_id' => $transferable->getKey(),
18            'transferable_type' => $transferable::class,
19        ]);
20    }
21}