<commit_before><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
 * Print Recursive
 *
 * Simply wraps a print_r() in pre tags for debugging.
 *
 * @param mixed
 * @return string
 */
if ( ! function_exists('_pr'))
{
    function _pr($a)
    {
        echo "<pre>";
        print_r($a);
        echo "</pre>";
    }
}

// ------------------------------------------------------------------------

/*
 * Variable Dump
 *
 * Simply wraps a var_dump() in pre tags for debugging.
 *
 * @param mixed
 * @return string
 */
if ( ! function_exists('_vd'))
{
    function _vd($a)
    {
        echo "<pre>";
        var_dump($a);
        echo "</pre>";
    }
}

// ------------------------------------------------------------------------

/*
 * Array to Object
 * 
 * Converts an array to an object
 *
 * @param array
 * @return object
 */
if ( ! function_exists('array_to_object'))
{
    function array_to_object($array)
    {
        $Object = new stdClass();
        foreach($array as $key=>$value)
        {
            $Object->$key = $value; 
        }

        return $Object;
    }
}

// ------------------------------------------------------------------------

/*
 * Object to Array
 * 
 * Converts an object to an array
 * 
 * @param object
 * @return array
 */
if ( ! function_exists('object_to_array'))
{
    function object_to_array($Object)
    {
        $array = get_object_vars($Object);

        return $array;
    }<commit_msg>Added optional recursive array to object conversion option  to the array_to_object method<commit_after><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
 * Print Recursive
 *
 * Simply wraps a print_r() in pre tags for debugging.
 *
 * @param mixed
 * @return string
 */
if ( ! function_exists('_pr'))
{
    function _pr($a)
    {
        echo "<pre>";
        print_r($a);
        echo "</pre>";
    }
}

// ------------------------------------------------------------------------

/*
 * Variable Dump
 *
 * Simply wraps a var_dump() in pre tags for debugging.
 *
 * @param mixed
 * @return string
 */
if ( ! function_exists('_vd'))
{
    function _vd($a)
    {
        echo "<pre>";
        var_dump($a);
        echo "</pre>";
    }
}

// ------------------------------------------------------------------------

/**
 * Array to Object
 * 
 * Converts an array to an object with optional param for recursion 
 *
 * @param   int $recursion Defaults to false 
 * @param   array $array 
 * @return  object
 */
if ( ! function_exists('array_to_object'))
{
    function array_to_object($array, $recursion = false)
    {
        $Object = new stdClass();
        foreach($array as $key => $value)
        {
            if ($recursion && is_array($value)) {
                $value = array_to_object($value);
            }
            $Object->$key = $value; 
        }

        return $Object;
    }
}

// ------------------------------------------------------------------------

/*
 * Object to Array
 * 
 * Converts an object to an array
 * 
 * @param object
 * @return array
 */
if ( ! function_exists('object_to_array'))
{
    function object_to_array($Object)
    {
        $array = get_object_vars($Object);

        return $array;
    }
{'fraction_non_alphanumeric': 0.2604392205381998, 'fraction_numerical': 0.0, 'mean_word_length': 1.4630616907844631, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '3825365', 'n_tokens_mistral': 930, 'n_tokens_neox': 899, 'n_words': 239}