1 | <?php |
||
23 | class Database extends BaseEventEmitter implements DatabaseInterface |
||
24 | { |
||
25 | use LoopAwareTrait; |
||
26 | |||
27 | const STATE_INIT = 0; |
||
28 | const STATE_CONNECT_PENDING = 3; |
||
29 | const STATE_CONNECT_FAILED = 1; |
||
30 | const STATE_CONNECT_SUCCEEDED = 4; |
||
31 | const STATE_AUTH_PENDING = 8; |
||
32 | const STATE_AUTH_FAILED = 2; |
||
33 | const STATE_AUTH_SUCCEEDED = 5; |
||
34 | const STATE_CLOSEING = 6; |
||
35 | const STATE_STOPPED = 7; |
||
36 | |||
37 | protected $config; |
||
38 | |||
39 | protected $serverOptions; |
||
40 | |||
41 | protected $executor; |
||
42 | |||
43 | protected $state = self::STATE_INIT; |
||
44 | |||
45 | protected $stream; |
||
46 | |||
47 | protected $parser; |
||
48 | |||
49 | /** |
||
50 | * @param LoopInterface $loop |
||
51 | * @param mixed[] $config |
||
52 | */ |
||
53 | public function __construct(LoopInterface $loop, $config = []) |
||
59 | |||
60 | /** |
||
61 | * @override |
||
62 | * @inheritDoc |
||
63 | */ |
||
64 | public function isPaused() |
||
68 | |||
69 | /** |
||
70 | * @override |
||
71 | * @inheritDoc |
||
72 | */ |
||
73 | public function pause() |
||
77 | |||
78 | /** |
||
79 | * @override |
||
80 | * @inheritDoc |
||
81 | */ |
||
82 | public function resume() |
||
86 | |||
87 | /** |
||
88 | * @override |
||
89 | * @inheritDoc |
||
90 | */ |
||
91 | public function isStarted() |
||
95 | |||
96 | /** |
||
97 | * @override |
||
98 | * @inheritDoc |
||
99 | */ |
||
100 | public function start() |
||
141 | |||
142 | /** |
||
143 | * @override |
||
144 | * @inheritDoc |
||
145 | */ |
||
146 | public function stop() |
||
160 | |||
161 | /** |
||
162 | * Do a async query. |
||
163 | * |
||
164 | * @param string $sql |
||
165 | * @param mixed[] $sqlParams |
||
166 | * @return PromiseInterface |
||
167 | */ |
||
168 | public function query($sql, $sqlParams = []) |
||
190 | |||
191 | public function ping() |
||
203 | |||
204 | public function selectDB($dbname) |
||
208 | |||
209 | public function setOption($name, $value) |
||
215 | |||
216 | public function getOption($name, $default = null) |
||
225 | |||
226 | public function getState() |
||
230 | |||
231 | public function handleConnectionError($err) |
||
235 | |||
236 | public function handleConnectionClosed() |
||
244 | |||
245 | protected function doCommand(CommandInterface $command) |
||
260 | |||
261 | public function getServerOptions() |
||
265 | |||
266 | protected function connect() |
||
271 | |||
272 | /** |
||
273 | * Create executor. |
||
274 | * |
||
275 | * @return Executor |
||
276 | */ |
||
277 | protected function createExecutor() |
||
281 | |||
282 | /** |
||
283 | * Create configuration file. |
||
284 | * |
||
285 | * @param mixed[] $config |
||
286 | * @return mixed[] |
||
287 | */ |
||
288 | protected function createConfig($config = []) |
||
298 | } |
||
299 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.