| Total Complexity | 8 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class TermVectors extends AbstractEndpoint |
||
| 18 | { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param array $body |
||
| 22 | * |
||
| 23 | * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException |
||
| 24 | * @return $this |
||
| 25 | */ |
||
| 26 | public function setBody($body) |
||
| 27 | { |
||
| 28 | if (isset($body) !== true) { |
||
| 29 | return $this; |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->body = $body; |
||
| 33 | return $this; |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * @throws \Elasticsearch\Common\Exceptions\RuntimeException |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | protected function getURI() |
||
| 42 | { |
||
| 43 | if (isset($this->index) !== true) { |
||
| 44 | throw new Exceptions\RuntimeException( |
||
| 45 | 'index is required for TermVectors' |
||
| 46 | ); |
||
| 47 | } |
||
| 48 | if (isset($this->type) !== true) { |
||
| 49 | throw new Exceptions\RuntimeException( |
||
| 50 | 'type is required for TermVectors' |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | if (isset($this->id) !== true) { |
||
| 54 | throw new Exceptions\RuntimeException( |
||
| 55 | 'id is required for TermVectors' |
||
| 56 | ); |
||
| 57 | } |
||
| 58 | |||
| 59 | $index = $this->index; |
||
| 60 | $type = $this->type; |
||
| 61 | $id = $this->id; |
||
| 62 | $uri = "/$index/$type/$id/_termvectors"; |
||
| 63 | |||
| 64 | return $uri; |
||
| 65 | |||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return string[] |
||
| 70 | */ |
||
| 71 | protected function getParamWhitelist() |
||
| 72 | { |
||
| 73 | return array( |
||
| 74 | 'term_statistics', |
||
| 75 | 'field_statistics', |
||
| 76 | 'fields', |
||
| 77 | 'offsets', |
||
| 78 | 'positions', |
||
| 79 | 'payloads', |
||
| 80 | 'preference', |
||
| 81 | 'routing', |
||
| 82 | 'parent', |
||
| 83 | 'realtime' |
||
| 84 | ); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @return string |
||
| 89 | */ |
||
| 90 | protected function getMethod() |
||
| 91 | { |
||
| 92 | return 'POST'; |
||
| 93 | } |
||
| 94 | } |