Completed
Pull Request — develop (#39)
by Sam
01:56
created

DeleteCommand::getElasticsearchService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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