<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 collection.
     *
     * @octdoc      c:mongodb/collection
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class collection
    /**/
    {
        /**
         * Device the collection belongs to.
         *
         * @octdoc  p:collection/$device
         * @var     \org\octris\core\db\device\mongodb
         */
        protected $device;
        /**/

        /**
         * Instance of collection.
         *
         * @octdoc  p:collection/$collection
         * @var     string
         */
        protected $collection;
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:collection/__construct
         * @param   \org\octris\core\db\device\mongodb  $device             Device the connection belongs to.
         * @param   \MongoCollection                    $collection         Instance of collection to handle.
         */
        public function __construct(\org\octris\core\db\device\mongodb $device, \MongoCollection $collection)
        /**/
        {
            $this->device     = $device;
            $this->collection = $collection;
        }

        /**
         * Return name of collection.
         *
         * @octdoc  m:collection/getName
         * @return  string                                              Name of collection.
         */
        public function getName()
        /**/
        {
            return $this->collection->getName();
        }

        /**
         * Create an empty object for storing data into specified collection.
         *
         * @octdoc  m:collection/create
         * @return  \org\octris\core\db\device\mongodb\dataobject       Data object.
         */
        public function create()
        /**/
        {
            return new \org\octris\core\db\device\mongodb\dataobject($this->device, $this->getName());
        }

        /**
         * Query the database and count the results.
         *<commit_msg>create can now take for initialization<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 collection.
     *
     * @octdoc      c:mongodb/collection
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class collection
    /**/
    {
        /**
         * Device the collection belongs to.
         *
         * @octdoc  p:collection/$device
         * @var     \org\octris\core\db\device\mongodb
         */
        protected $device;
        /**/

        /**
         * Instance of collection.
         *
         * @octdoc  p:collection/$collection
         * @var     string
         */
        protected $collection;
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:collection/__construct
         * @param   \org\octris\core\db\device\mongodb  $device             Device the connection belongs to.
         * @param   \MongoCollection                    $collection         Instance of collection to handle.
         */
        public function __construct(\org\octris\core\db\device\mongodb $device, \MongoCollection $collection)
        /**/
        {
            $this->device     = $device;
            $this->collection = $collection;
        }

        /**
         * Return name of collection.
         *
         * @octdoc  m:collection/getName
         * @return  string                                              Name of collection.
         */
        public function getName()
        /**/
        {
            return $this->collection->getName();
        }

        /**
         * Create an empty object for storing data into specified collection.
         *
         * @octdoc  m:collection/create
         * @param   array                                           $data       Optional data to store in data object.
         * @return  \org\octris\core\db\device\mongodb\dataobject               Data object.
         */
        public function create(array $data = array())
        /**/
        {
            return new \org\octris\core\db\device\mongodb\dataobject($this->device, $this->getName(), $data);
        }

        /**
         * Query the database and count the results.
         *
{'fraction_non_alphanumeric': 0.11069023569023569, 'fraction_numerical': 0.0016835016835016834, 'mean_word_length': 1.3588089330024813, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813910', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1228, 'n_words': 306}