<commit_before><?php

namespace MongoMinify;

class Db {

	public $name;
	public $client;
	public $native;

	public $collection_cache = array();

	public function __construct($name, $client)
	{
		$this->name = $name;
		$this->client = $client;
		$this->native = $client->native->selectDb($name);
	}


	/**
	 * Select Collection
	 */
	public function __get($name)
	{
		return $this->selectCollection($name);
	}
	

	/**
	 * Select Collection
	 */
	public function selectCollection($name)
	{
		if ( ! isset($this->collection_cache[$name]))
		{
			$collection = new Collection($name, $this);
			$collection_cache[$name] = $collection;
		}
		return $collection_cache[$name];
	}


	/**
	 * Command
	 */
	public function command(array $command, array $options = array())
	{
		return $this->native->command($command, $options);
	}

}<commit_msg>Added last error helper command<commit_after><?php

namespace MongoMinify;

class Db {

	public $name;
	public $client;
	public $native;

	public $collection_cache = array();

	public function __construct($name, $client)
	{
		$this->name = $name;
		$this->client = $client;
		$this->native = $client->native->selectDb($name);
	}


	/**
	 * Select Collection
	 */
	public function __get($name)
	{
		return $this->selectCollection($name);
	}
	

	/**
	 * Select Collection
	 */
	public function selectCollection($name)
	{
		if ( ! isset($this->collection_cache[$name]))
		{
			$collection = new Collection($name, $this);
			$collection_cache[$name] = $collection;
		}
		return $collection_cache[$name];
	}


	/**
	 * Command
	 */
	public function command(array $command, array $options = array())
	{
		return $this->native->command($command, $options);
	}

	/**
	 * Last Error Helper
	 */
	public function lastError()
	{
		$this->native->command(array('getLastError' => 1));
	}

}
{'fraction_non_alphanumeric': 0.16758544652701213, 'fraction_numerical': 0.0005512679162072767, 'mean_word_length': 3.879032258064516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '1269162', 'n_tokens_mistral': 650, 'n_tokens_neox': 587, 'n_words': 126}