Main   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A onEnable() 0 12 1
A onDisable() 0 7 2
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
}