RestartCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Integration\Laravel\Console\Commands;
6
7
use Umbrellio\TableSync\Integration\Laravel\Console\ProcessManagerCommand;
8
9
class RestartCommand extends ProcessManagerCommand
10
{
11
    protected $signature = 'table_sync:restart {--force}';
12
    protected $description = 'Restart table_sync worker.';
13
14
    public function handle(): void
15
    {
16
        if (!$this->pidManager->pidExists()) {
17
            $this->info('Table sync worker not started.');
18
        } else {
19
            $arguments = $this->option('force') ? [
20
                '--force' => true,
21
            ] : [];
22
23
            $this->call('table_sync:terminate', $arguments);
24
        }
25
26
        $this->call('table_sync:work');
27
    }
28
}
29