<commit_before><?php
	namespace REST\Components\Database;

	class PDOBase implements \REST\Interfaces\DatabaseAdapter
	{
		private $db;
		private $host;
		private $user;
		private $pass;
		private $base;
		private $char;

		public function __construct(\REST\Configuration\Requisites $req)
		{
			$this->host = $req->host();
			$this->user = $req->user();
			$this->pass = $req->pass();
			$this->base = $req->base();
			$this->char = $req->char();
		}

		public function connect()
		{
			$dsn = 'mysql:host=' . $this->host . ';' .
				   'dbname='     . $this->base . ';' .
				   'charset='    . $this->char . ';';
			$this->db = new \PDO($dsn, $this->user, $this->pass);
		}

		public function getQuery(string $request,
								 array  $params = array(),
								 string $requestType)
		{
			$result = false;
			$stmt   = $this->db->prepare($request);

			foreach ($params as $pholder => $val) {
				if (is_int($val))
					$stmt->bindValue($pholder, $val, \PDO::PARAM_INT);
				else
					$stmt->bindValue($pholder, $val, \PDO::PARAM_STR);
			}

			$stmt->execute();

			switch ($requestType)
			{
				case 'insert':
				case 'update':
				case 'delete':
					$result = $stmt->rowCount();
					break;

				case 'select':
					$result = $stmt->fetch(\PDO::FETCH_OBJ);
					break;

				case 'selectAll':
					$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
					break;

				default:
					throw new \Exception('PDOBase :  wrong request type' . PHP_EOL);
			}

			return $result;
		}
	}
<commit_msg>Database :  PDOBase, added disconnect method<commit_after><?php
	namespace REST\Components\Database;

	class PDOBase implements \REST\Interfaces\DatabaseAdapter
	{
		private $db;
		private $host;
		private $user;
		private $pass;
		private $base;
		private $char;

		public function __construct(\REST\Configuration\Requisites $req)
		{
			$this->host = $req->host();
			$this->user = $req->user();
			$this->pass = $req->pass();
			$this->base = $req->base();
			$this->char = $req->char();
		}

		public function connect()
		{
			$dsn = 'mysql:host=' . $this->host . ';' .
				   'dbname='     . $this->base . ';' .
				   'charset='    . $this->char . ';';
			$this->db = new \PDO($dsn, $this->user, $this->pass);
		}

		public function disconnect()
		{
			unset($this->db);
		}

		public function getQuery(string $request,
								 array  $params = array(),
								 string $requestType)
		{
			$result = false;
			$stmt   = $this->db->prepare($request);

			foreach ($params as $pholder => $val) {
				if (is_int($val))
					$stmt->bindValue($pholder, $val, \PDO::PARAM_INT);
				else
					$stmt->bindValue($pholder, $val, \PDO::PARAM_STR);
			}

			$stmt->execute();

			switch ($requestType)
			{
				case 'insert':
				case 'update':
				case 'delete':
					$result = $stmt->rowCount();
					break;

				case 'select':
					$result = $stmt->fetch(\PDO::FETCH_OBJ);
					break;

				case 'selectAll':
					$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
					break;

				default:
					throw new \Exception('PDOBase :  wrong request type' . PHP_EOL);
			}

			return $result;
		}
	}

{'fraction_non_alphanumeric': 0.18530559167750324, 'fraction_numerical': 0.0, 'mean_word_length': 2.680622009569378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7367266', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1070, 'n_words': 222}