Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ClientsSyncFull | |
80.00% |
4 / 5 |
|
50.00% |
1 / 2 |
3.07 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| handle | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
2.06 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Console\Commands; |
| 4 | |
| 5 | use App\Services\GestionaClientSyncService; |
| 6 | use Illuminate\Console\Command; |
| 7 | |
| 8 | class ClientsSyncFull extends Command |
| 9 | { |
| 10 | /** |
| 11 | * The name and signature of the console command. |
| 12 | * |
| 13 | * @var string |
| 14 | */ |
| 15 | protected $signature = 'clients:sync-full {region?}'; |
| 16 | |
| 17 | /** |
| 18 | * The console command description. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | protected $description = 'Sync all clients from Gestiona (G3W) since the beginning of time. Creates or updates local client records. Manual use only.'; |
| 23 | |
| 24 | /** |
| 25 | * Create a new command instance. |
| 26 | */ |
| 27 | public function __construct(private readonly GestionaClientSyncService $syncService) |
| 28 | { |
| 29 | parent::__construct(); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Execute the console command. |
| 34 | */ |
| 35 | public function handle(): int |
| 36 | { |
| 37 | $regions = $this->argument('region') |
| 38 | ? explode(',', $this->argument('region')) |
| 39 | : ['Cataluña', 'Madrid', 'Comunidad Valenciana', 'AndalucĂa', 'Baleares']; |
| 40 | |
| 41 | return $this->syncService->runSync('2000-01-01', $regions, $this); |
| 42 | } |
| 43 | } |