Total Complexity | 5 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class ExplainQuery extends EmulateBySql |
||
10 | { |
||
11 | use Utils; |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $_index; |
||
16 | |||
17 | public function setBody($params = null) |
||
18 | { |
||
19 | if (isset($this->_index)) { |
||
20 | if(isset($params['query'])) |
||
21 | { |
||
22 | return parent::setBody(['query' => "EXPLAIN QUERY ".$this->_index. '\''.$params['query'].'\'']); |
||
23 | } |
||
24 | throw new RuntimeException('Query param is missing.'); |
||
25 | } |
||
26 | throw new RuntimeException('Index name is missing.'); |
||
27 | } |
||
28 | /** |
||
29 | * @return mixed |
||
30 | */ |
||
31 | public function getIndex() |
||
32 | { |
||
33 | return $this->_index; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param mixed $index |
||
38 | */ |
||
39 | public function setIndex($index) |
||
42 | } |
||
43 | |||
44 | } |