Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| IntegrationUpdateService | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| update | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
| 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\Shared\Interfaces\DataTransferObjectInterface; |
| 9 | |
| 10 | class IntegrationUpdateService |
| 11 | { |
| 12 | public function update(DataTransferObjectInterface $integrationDTO, Integration $integration, User $user): Integration |
| 13 | { |
| 14 | $integration->setAttribute('parameters', $integrationDTO->toArray()); |
| 15 | if ($integration->isDirty()) { |
| 16 | $integration->save(); |
| 17 | } |
| 18 | |
| 19 | ServiceProcessed::dispatch(self::class, $user); |
| 20 | return $integration; |
| 21 | } |
| 22 | } |