<?php
class MySqliWrapper
{
	public static $instance;

	public static function getInstance()
	{
		if(!MySqliWrapper::$instance)
		{
			MySqliWrapper::$instance = new MySqliWrapper();
		}
		return MySqliWrapper::$instance;
	}
	private $mysqli;

	private function __construct()
	{
		$this->mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
	}

	public function get($key)
	{
		$result = $this->mysqli->query($key);
		if($result)
		{
			$data = array();
			while ($row = $result->fetch_assoc())
			{
				$data[] = $row;
			}
			if(count($data) == 1)
			{
				return $data;
			}
			return $data;
		}
		return false;
	}

	public function add($key, $value)
	{
		$this->mysqli->query($key);
	}

	public function set($key, $value)
	{
		$this->mysqli->query($key);
	}

	public function delete($key)
	{
		$this->mysqli->query($key);
	}
}