Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
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 | } |
||
28 | throw new RuntimeException('Missing import index path in /indices/import'); |
||
29 | } |
||
30 | throw new RuntimeException('Missing index name in /indices/import'); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | */ |
||
36 | public function getIndex() |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param mixed $index |
||
43 | */ |
||
44 | public function setIndex($index) |
||
47 | } |
||
48 | } |