Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| StockInputDevolutionIntegrationStoreService | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| store | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\StockIO\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\Integration\Integration; |
| 7 | use App\Models\User; |
| 8 | use Domain\Integration\DTOs\IntegrationStockInputDevolutionDTO; |
| 9 | use Domain\Integration\Interfaces\HasIntegration; |
| 10 | |
| 11 | readonly class StockInputDevolutionIntegrationStoreService |
| 12 | { |
| 13 | /** |
| 14 | * @param IntegrationStockInputDevolutionDTO $integrationDTO |
| 15 | * @param HasIntegration $hasIntegration |
| 16 | * @param User $user |
| 17 | * @return HasIntegration |
| 18 | */ |
| 19 | public function store(IntegrationStockInputDevolutionDTO $integrationDTO, HasIntegration $hasIntegration, User $user): HasIntegration |
| 20 | { |
| 21 | $integration = new Integration(); |
| 22 | $integration->setAttribute('parameters', $integrationDTO->toArray()); |
| 23 | $hasIntegration->integration()->save($integration); |
| 24 | |
| 25 | ServiceProcessed::dispatch(self::class, $user); |
| 26 | return $hasIntegration; |
| 27 | } |
| 28 | } |