<commit_before><?php

class jQueryTmpl_Data
{
    private $_data;

    public function __construct(stdClass $data)
    {
        // The json_decode() returned stdObject
        $this->_data = $data;
    }

    public function getValueOf($jsNotation)
    {
    }
}
<commit_msg>Adding private method to parse js notation into tokens to be acted upon<commit_after><?php

class jQueryTmpl_Data
{
    private $_data;

    public function __construct(stdClass $data)
    {
        // The json_decode() returned stdObject
        $this->_data = $data;
    }

    public function getValueOf($jsNotation)
    {
        $dataTokens = $this->_parseJsNotation($jsNotation);
    }

    private function _parseJsNotation($js)
    {
        $dataTokens = array();

        // Split based on '.' to traverse into object. Could be smarter...
        $loc = explode('.', $js);
        $len = count($loc);

        foreach($loc as $idx => $name)
        {
            $match = array();

            if (!preg_match('/^([a-z_$][0-9a-z_$]*)(\[.*\])?$/i', $name, $match))
            {
                throw new jQueryTmpl_Data_Exception('jQueryTmpl_Data can not evaluate expressions.');
            }

            $dataToken = array
            (
                'name' => $match[1]
            );

            if (!empty($match[2]))
            {
                // Use trim to extract the core value between brackets
                $dataToken['subpart'] = trim($match[2], ' \'"[]');
            }

            $dataTokens[] = $dataToken;
        }

        return $dataTokens;
    }
}

{'fraction_non_alphanumeric': 0.13529036375239312, 'fraction_numerical': 0.003190810465858328, 'mean_word_length': 1.8050089445438282, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '2714530', 'n_tokens_mistral': 477, 'n_tokens_neox': 454, 'n_words': 108}