Doc   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 64
rs 10
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getMethod() 0 3 1
A setIndex() 0 3 1
A getIndex() 0 3 1
A getPath() 0 10 3
A setId() 0 3 1
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