DeleteIndexTask   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 27
ccs 0
cts 9
cp 0
rs 10
c 1
b 1
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A run() 0 7 1
1
<?php
2
3
namespace SilverStripe\Elastica;
4
5
/**
6
 * Defines and refreshes the elastic search index.
7
 */
8
class DeleteIndexTask extends \BuildTask {
9
10
	protected $title = 'Elastic Search Index Deletion';
11
12
	protected $description = 'Deletes the configured elastic search index';
13
14
	/**
15
	 * @var ElasticaService
16
	 */
17
	private $service;
18
19
	public function __construct(ElasticaService $service) {
20
		$this->service = $service;
21
	}
22
23
	/**
24
	 * Execute the task to delete the currently configured index
25
	 */
26
	public function run($request) {
27
		$message = ElasticaUtil::getPrinter();
28
29
		$this->service->define();
30
		$this->service->reset();
31
		$message('Successfully deleted configured index');
32
	}
33
34
}
35