DeleteCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 8
c 1
b 0
f 1
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 1
1
<?php namespace Nord\Lumen\Elasticsearch\Console;
2
3
use Nord\Lumen\Elasticsearch\IndexNamePrefixer;
4
5
class DeleteCommand extends AbstractCommand
6
{
7
8
    /**
9
     * The name and signature of the console command.
10
     *
11
     * @var string
12
     */
13
    protected $signature = 'elastic:index:delete {index}';
14
15
    /**
16
     * The console command description.
17
     *
18
     * @var string
19
     */
20
    protected $description = 'Deletes an Elasticsearch index.';
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function handle()
26
    {
27
        $index = IndexNamePrefixer::getPrefixedIndexName((string)$this->argument('index'));
28
29
        $this->info(sprintf("Deleting index '%s' ...", $index));
30
31
        $this->elasticsearchService->indices()->delete(['index' => $index]);
32
33
        $this->info(sprintf("Index '%s' deleted.", $index));
34
35
        return 0;
36
    }
37
}
38