<commit_before><?php

namespace Tedivm\StashBundle\Service;

/**
 * Basic in-memory query
 *
 * @author <NAME> <<EMAIL>>
 */
class CacheLogger
{
    protected $name;

    protected $calls = 0;
    protected $hits = 0;

    protected $queries = array();

    public function __construct($name)
    {
        $this->name = $name;
    }

    public function logRequest($key, $hit, $value)
    {
        $this->calls++;
        if($hit) {
            $this->hits++;
        }

        $leader = sprintf('@@_%s_@@/', $this->name);
        if(strpos($key, $leader) === 0) {
            $key = substr($key, strlen($leader));
        }

        $hit = $hit ? 'true' : 'false';

        ob_start();
        print_r($value);
        $value = sprintf('(%s) %s', gettype($value), ob_get_clean());

        $this->queries[] = array(
            'key'   => $key,
            'hit'   => $hit,
            'value' => $value
        );
    }

    public function getName()
    {
        return $this->name;
    }

    public function getCalls()
    {<commit_msg>Update Service/CacheLogger.php<commit_after><?php

namespace Tedivm\StashBundle\Service;

/**
 * Basic in-memory query
 *
 * @author <NAME> <<EMAIL>>
 */
class CacheLogger
{
    protected $name;

    protected $calls = 0;
    protected $hits = 0;

    protected $queries = array();

    public function __construct($name)
    {
        $this->name = $name;
    }

    public function logRequest($key, $hit, $value)
    {
        $this->calls++;
        if($hit) {
            $this->hits++;
        }

        $leader = sprintf('@@_%s_@@/', $this->name);
        if(strpos($key, $leader) === 0) {
            $key = substr($key, strlen($leader));
        }

        $hit = $hit ? 'true' : 'false';
        $value = sprintf('(%s) %s', gettype($value), print_r($value, true));

        $this->queries[] = array(
            'key'   => $key,
            'hit'   => $hit,
            'value' => $value
        );
    }

    public function getName()
    {
        return $this->name;
    }

    public function getCalls()
    {
{'fraction_non_alphanumeric': 0.1784332688588008, 'fraction_numerical': 0.0029013539651837525, 'mean_word_length': 1.8736111111111111, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '7283851', 'n_tokens_mistral': 696, 'n_tokens_neox': 674, 'n_words': 142}