Delete::setCluster()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 2
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Manticoresearch\Endpoints\Cluster;
4
5
use Manticoresearch\Endpoints\EmulateBySql;
6
use Manticoresearch\Endpoints\Sql;
7
use Manticoresearch\Exceptions\RuntimeException;
8
use Manticoresearch\Utils;
9
10
/**
11
 * @todo maybe pattern should be a query parameter rather than body?
12
 * Class Status
13
 * @package Manticoresearch\Endpoints\Indices
14
 */
15
class Delete extends EmulateBySql
16
{
17
    use Utils;
18
    /**
19
     * @var string
20
     */
21
    protected $cluster;
22
23
    public function setBody($params = null)
24
    {
25
        if (isset($this->cluster)) {
26
            return parent::setBody(['query' => "DELETE CLUSTER ".$this->cluster]);
27
        }
28
        throw new RuntimeException('Cluster name is missing.');
29
    }
30
    /**
31
     * @return mixed
32
     */
33
    public function getCLuster()
34
    {
35
        return $this->cluster;
36
    }
37
38
    /**
39
     * @param mixed $cluster
40
     */
41
    public function setCluster($cluster)
42
    {
43
        $this->cluster = $cluster;
44
    }
45
}
46