Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
57.14% |
4 / 7 |
DockerDeleteService | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
2.31 | |
57.14% |
4 / 7 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
|||
handle | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\DockerLauncher\Console; |
4 | |
5 | |
6 | use Illuminate\Console\Command; |
7 | use Qmp\Laravel\DockerLauncher\Docker; |
8 | use Qmp\Laravel\DockerLauncher\Docker\DockerConfig; |
9 | |
10 | class DockerDeleteService extends Command |
11 | { |
12 | |
13 | /** |
14 | * The name and signature of the console command. |
15 | * |
16 | * @var string |
17 | */ |
18 | protected $signature = 'docker:delete-service {serviceName}'; |
19 | |
20 | /** |
21 | * The console command description. |
22 | * |
23 | * @var string |
24 | */ |
25 | protected $description = 'Delete the given docker service'; |
26 | |
27 | protected $docker; |
28 | |
29 | protected $config; |
30 | |
31 | /** |
32 | * Create a new command instance. |
33 | * |
34 | * @param Docker $docker |
35 | * @param array $config |
36 | */ |
37 | public function __construct(Docker $docker, DockerConfig $config) |
38 | { |
39 | parent::__construct(); |
40 | |
41 | $this->docker = $docker; |
42 | $this->config = $config; |
43 | |
44 | } |
45 | |
46 | /** |
47 | * Execute the console command. |
48 | * |
49 | * @return void |
50 | */ |
51 | public function handle(): void |
52 | { |
53 | $this->config->setScheduleName($this->argument('serviceName')); |
54 | $this->docker->removeOldService(true); |
55 | } |
56 | } |