<commit_before><?php

/*
 * This file is part of the 'org.octris.core' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\core\db\device\mongodb {
	/**
	 * MongoDB database device.
	 *
	 * @octdoc		c:mongodb/connection
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
	class connection implements \org\octris\core\db\device\connection_if
	/**/
	{
		/**
		 * Device.
		 *
		 * @octdoc  p:connection/$device
		 * @var     \org\octris\core\db\device\mongo
		 */
		protected $device;
		/**/

		/**
		 * Instance of mongo class.
		 *
		 * @octdoc  p:connection/$mongo
		 * @var     \Mongo
		 */
		protected $mongo;
		/**/

		/**
		 * Connection to a database.
		 *
		 * @octdoc  p:connection/$db
		 * @var     \MongoDB
		 */
		protected $db;
		/**/

		/**
		 * Constructor.
		 *
		 * @octdoc  m:connection/__construct
         * @param   array                       $options            Connection options.
		 */
		public function __construct(\org\octris\core\db\device\mongodb $device, array $options)
		/**/
		{
			$this->device = $device;
			$this->mongo  = new \Mongo(
				'mongodb://' . $options['host'] . ':' . $options['port'],
				array(
					'username' => $options['username'],
					'password' => $options['password'],
					'db'	   => $options['database']
				)
			);

			$this->db = $this->mongo->selectDB($database);
		}

		/**
		 * Release connection.
		 *
		 * @octdoc  m:connection/release
		 */
		public function release()
		/**/
		{
			$this->device->release($this);
		}
<commit_msg>authentication does not work currently, if username / password are empty … have to omit them<commit_after><?php

/*
 * This file is part of the 'org.octris.core' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\core\db\device\mongodb {
	/**
	 * MongoDB database device.
	 *
	 * @octdoc		c:mongodb/connection
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
	class connection implements \org\octris\core\db\device\connection_if
	/**/
	{
		/**
		 * Device.
		 *
		 * @octdoc  p:connection/$device
		 * @var     \org\octris\core\db\device\mongo
		 */
		protected $device;
		/**/

		/**
		 * Instance of mongo class.
		 *
		 * @octdoc  p:connection/$mongo
		 * @var     \Mongo
		 */
		protected $mongo;
		/**/

		/**
		 * Connection to a database.
		 *
		 * @octdoc  p:connection/$db
		 * @var     \MongoDB
		 */
		protected $db;
		/**/

		/**
		 * Constructor.
		 *
		 * @octdoc  m:connection/__construct
         * @param   array                       $options            Connection options.
		 */
		public function __construct(\org\octris\core\db\device\mongodb $device, array $options)
		/**/
		{
			$this->device = $device;
			$this->mongo  = new \Mongo(
				'mongodb://' . $options['host'] . ':' . $options['port'],
				array(
					// 'username' => $options['username'],
					// 'password' => $options['password'],
					'db'	   => $options['database']
				)
			);

			$this->db = $this->mongo->selectDB($database);
		}

		/**
		 * Release connection.
		 *
		 * @octdoc  m:connection/release
		 */
		public function release()
		/**/
		{
			$this->device->release($this);
		}

{'fraction_non_alphanumeric': 0.16816729596282312, 'fraction_numerical': 0.0023235550392099913, 'mean_word_length': 2.1977715877437327, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 37, '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': '4881708', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1121, 'n_words': 248}