Doc::setId()   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 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Manticoresearch\Endpoints\Pq;
4
5
use Manticoresearch\Exceptions\RuntimeException;
6
7
/**
8
 * Class Doc
9
 * @package Manticoresearch\Endpoints\Pq
10
 */
11
class Doc extends \Manticoresearch\Request
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $index;
17
    /**
18
     * @var integer
19
     */
20
    protected $id;
21
22
    /**
23
     * @return mixed|string
24
     */
25
    public function getMethod()
26
    {
27
        return 'POST';
28
    }
29
30
    /**
31
     * @return mixed|string
32
     */
33
    public function getPath()
34
    {
35
        if (isset($this->index)) {
36
            if (isset($this->id)) {
37
                return "/json/pq/" . $this->index . "/doc/" . $this->id;
38
            } else {
39
                return "/json/pq/" . $this->index . "/doc";
40
            }
41
        }
42
        throw new RuntimeException('Index name is missing.');
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48
    public function getIndex()
49
    {
50
        return $this->index;
51
    }
52
53
    /**
54
     * @param mixed $index
55
     */
56
    public function setIndex($index)
57
    {
58
        $this->index = $index;
59
    }
60
61
    /**
62
     * @return mixed
63
     */
64
    public function getId()
65
    {
66
        return $this->id;
67
    }
68
69
    /**
70
     * @param mixed $id
71
     */
72
    public function setId($id)
73
    {
74
        $this->id = $id;
75
    }
76
}
77