Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| IntegrationStoreService | |
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\Integration\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\Integration\Integration; |
| 7 | use App\Models\User; |
| 8 | use Domain\Integration\Interfaces\HasIntegration; |
| 9 | use Domain\Shared\Interfaces\DataTransferObjectInterface; |
| 10 | |
| 11 | class IntegrationStoreService |
| 12 | { |
| 13 | public function store(DataTransferObjectInterface $dto, HasIntegration $hasIntegration, User $user): Integration |
| 14 | { |
| 15 | $integration = new Integration(); |
| 16 | $integration->setAttribute('parameters', $dto->toArray()); |
| 17 | |
| 18 | $hasIntegration->integration()->save($integration); |
| 19 | |
| 20 | ServiceProcessed::dispatch(self::class, $user); |
| 21 | return $integration; |
| 22 | } |
| 23 | } |