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