Total Complexity | 5 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class Import extends EmulateBySql |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $index; |
||
15 | |||
16 | public function setBody($params = null) |
||
17 | { |
||
18 | if (isset($this->index)) { |
||
19 | if (isset($params['path'])) { |
||
20 | return parent::setBody([ |
||
21 | 'query' => 'IMPORT TABLE ' . |
||
22 | $this->index . |
||
23 | ' FROM ' . |
||
24 | $params['path'] |
||
25 | ]); |
||
26 | } |
||
27 | throw new RuntimeException('Missing import index path in /indices/import'); |
||
28 | } |
||
29 | throw new RuntimeException('Missing index name in /indices/import'); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function getIndex() |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param mixed $index |
||
42 | */ |
||
43 | public function setIndex($index) |
||
48 |