Total Complexity | 8 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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() |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param mixed $id |
||
71 | */ |
||
72 | public function setId($id) |
||
77 |