Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 2 | ||
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 | return parent::setBody(['query' => "EXPLAIN QUERY ".$this->index. '\''.$params['query'].'\'']); |
||
22 | } |
||
23 | throw new RuntimeException('Query param is missing.'); |
||
24 | } |
||
25 | throw new RuntimeException('Index name is missing.'); |
||
26 | } |
||
27 | /** |
||
28 | * @return mixed |
||
29 | */ |
||
30 | public function getIndex() |
||
31 | { |
||
32 | return $this->index; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param mixed $index |
||
37 | */ |
||
38 | public function setIndex($index) |
||
41 | } |
||
42 | } |
||
43 |