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