<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\riak {
    /**
     * Riak data object
     *
     * @octdoc      c:riak/subobject
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class subobject implements \ArrayAccess, \Countable, \IteratorAggregate
    /**/
    {
        /**
         * Data to store in object.
         *
         * @octdoc  p:subobject/$data
         * @var     array
         */
        protected $data = array();
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:subobject/__construct
         * @param   array           $data           Data to initialize object with,
         */
        public function __construct(array $data = array())
        /**/
        {
            foreach ($data as $key => $value) {
                $this[$key] = $value; 
            }
        }

        /**
         * Supports deep copy cloning.
         *
         * @octdoc  m:subobject/__clone
         */
        public function __clone()
        /**/
        {
            foreach ($this->data as $key => $value) {
                if ($value instanceof self) {
                    $this[$key] = clone($value);
                }
            }
        }

        /**
         * Convert to array.
         *<commit_msg>object is now serializable with json_encode<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\riak {
    /**
     * Riak data object
     *
     * @octdoc      c:riak/subobject
     * @copyright   copyright (c) 2012 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class subobject implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializable
    /**/
    {
        /**
         * Data to store in object.
         *
         * @octdoc  p:subobject/$data
         * @var     array
         */
        protected $data = array();
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:subobject/__construct
         * @param   array           $data           Data to initialize object with,
         */
        public function __construct(array $data = array())
        /**/
        {
            foreach ($data as $key => $value) {
                $this[$key] = $value;
            }
        }

        /**
         * Supports deep copy cloning.
         *
         * @octdoc  m:subobject/__clone
         */
        public function __clone()
        /**/
        {
            foreach ($this->data as $key => $value) {
                if ($value instanceof self) {
                    $this[$key] = clone($value);
                }
            }
        }

        /**
         * Magic method gets called, when 'json_encode' is used on the object instance.
         *
         * @octdoc  m:subobject/jsonSerialize
         * @return  array                                   Array representation of object.
         */
        public function jsonSerialize()
        /**/
        {
            return $this->getArrayCopy();
        }

        /**
         * Convert to array.
         *
{'fraction_non_alphanumeric': 0.11831951986281795, 'fraction_numerical': 0.002286367533581023, 'mean_word_length': 1.2712524334847501, 'pattern_counts': {'":': 0, '<': 19, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5202875', 'n_tokens_mistral': 974, 'n_tokens_neox': 950, 'n_words': 253}