Search::getIndex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Manticoresearch\Endpoints\Pq;
5
6
use Manticoresearch\Exceptions\RuntimeException;
7
use Manticoresearch\Request;
8
9
/**
10
 * Class Search
11
 * @package Manticoresearch\Endpoints\Pq
12
 */
13
class Search extends Request
14
{
15
16
    /**
17
     * @var string
18
     */
19
    protected $index;
20
21
    /**
22
     * @return mixed|string
23
     */
24
    public function getMethod()
25
    {
26
        return 'POST';
27
    }
28
29
    /**
30
     * @return mixed|string
31
     */
32
    public function getPath()
33
    {
34
        if (isset($this->index)) {
35
            return "/json/pq/" . $this->index . "/_search";
36
        }
37
        throw new RuntimeException('Index name is missing.');
38
    }
39
40
    /**
41
     * @return mixed
42
     */
43
    public function getIndex()
44
    {
45
        return $this->index;
46
    }
47
48
    /**
49
     * @param mixed $index
50
     */
51
    public function setIndex($index)
52
    {
53
        $this->index = $index;
54
    }
55
}
56