<commit_before><?php

/*****************************************
 * Title : PHP Quick Profiler Console Class
 * Author : Created by <NAME>
 * URL : http://particletree.com/features/php-quick-profiler/
 * Description : This class serves as a wrapper to hold onto
 *  various messages and profiling data
 *****************************************/

namespace Particletree\Pqp;

use Exception;

class Console
{

    /** @var  array */
    protected $store = array();

    /**
     * Logs data to the console
     * Accepts any data type
     *
     * @param mixed $data
     */
    public function log($data)
    {
        array_push($this->store, array(
          'data' => $data,
          'type' => 'log'
        ));
    }

    /**
     * Logs memory usage of a variable
     * If no parameter is passed in, logs current memory usage
     *
     * @param mixed $object
     * @param string $name
     */
    public function logMemory($object = null, $name = 'PHP')
    {
        $memory = memory_get_usage();
        $data_type = '';
        if (!is_null($object)) {
            $memory = strlen(serialize($object));
            $data_type = gettype($object);
        }

        array_push($this->store, array(
            'name'      => $name,
            'data'      => $memory,
            'data_type' => $data_type,
            'type'      => 'memory'
        ));
    }

    /**<commit_msg>Camel case is bad, apparently<commit_after><?php

/*****************************************
 * Title : PHP Quick Profiler Console Class
 * Author : Created by <NAME>
 * URL : http://particletree.com/features/php-quick-profiler/
 * Description : This class serves as a wrapper to hold onto
 *  various messages and profiling data
 *****************************************/

namespace Particletree\Pqp;

use Exception;

class Console
{

    /** @var  array */
    protected $store = array();

    /**
     * Logs data to the console
     * Accepts any data type
     *
     * @param mixed $data
     */
    public function log($data)
    {
        array_push($this->store, array(
          'data' => $data,
          'type' => 'log'
        ));
    }

    /**
     * Logs memory usage of a variable
     * If no parameter is passed in, logs current memory usage
     *
     * @param mixed $object
     * @param string $name
     */
    public function logMemory($object = null, $name = 'PHP')
    {
        $memory = memory_get_usage();
        $dataType = '';
        if (!is_null($object)) {
            $memory = strlen(serialize($object));
            $dataType = gettype($object);
        }

        array_push($this->store, array(
            'name'      => $name,
            'data'      => $memory,
            'data_type' => $dataType,
            'type'      => 'memory'
        ));
    }

    /**
{'fraction_non_alphanumeric': 0.18243484469832202, 'fraction_numerical': 0.0, 'mean_word_length': 2.0096670247046187, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '1496120', 'n_tokens_mistral': 800, 'n_tokens_neox': 791, 'n_words': 218}