Main::onDisable()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: UramnOIL
5
 * Date: 2018/10/02
6
 * Time: 1:00
7
 */
8
9
namespace VectorNetworkProject\DataProvider;
10
11
12
use pocketmine\plugin\PluginBase;
13
use poggit\libasynql\libasynql;
14
use poggit\libasynql\DataConnector;
15
use VectorNetworkProject\DataProvider\Tables\TableManager;
16
17
class Main extends PluginBase
18
{
19
20
	/** @var TableManager */
21
	private $manager;
22
	/** @var DataConnector */
23
	private $connector;
24
	public function onEnable()
25
	{
26
		$this->saveDefaultConfig();
27
		$this->connector = $connector = libasynql::create(
28
			$this,
29
			$this->getConfig()->get("database"),
30
			[
31
				"sqlite" => "sqlite.sql",
32
			]
33
		);
34
		$this->manager = new TableManager($connector);
35
	}
36
37
	public function onDisable()
38
	{
39
		if($this->connector !== null)
40
		{
41
			$this->connector->close();
42
		}
43
	}
44
}