RestartCommand::handle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 8
cp 0
rs 10
cc 3
nc 3
nop 0
crap 12
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