<commit_before><?php
namespace Devtools;
    
class Log {
    private $testCount;
    private $_config;
    private $_file;

    public function __construct($options=[])
    {
        $defaults = [
            'type'=>'file',
            'file'=>'Log.log'
        ];

        $this->_config = array_merge($defaults, $options);

        switch($this->_config['type']) {
            case 'file':    
                $this->_file = $this->_config['file'];
                $this->file(date("m-d-Y H:i:s"));
                $this->_testCount = 0;
                break;
            default:
                throw new \Exception($this->_config['type'].' is not a valid Log type');
                break;
        }
    }

    public function file($content, $result='EMPTY')
    {
        $endline = "\r\n";
        $content = $this->_tapify($content, $result);

        print "<div>$content</div>";
        return file_put_contents($this->_file, $content.$endline, FILE_APPEND);
    }

    private function _tapify($content, $result) {
        $nextTest = $this->testCount+1;
        $prefix = 'ok '.$nextTest.' - ';
            
        if($result!=='EMPTY') {
                $this->testCount = $nextTest;
                $content = $prefix.$content;
            if(!$result) {<commit_msg>Changes exception type to InvalidArgument<commit_after><?php
namespace Devtools;
    
class Log {
    private $testCount;
    private $_config;
    private $_file;

    public function __construct($options=[])
    {
        $defaults = [
            'type'=>'file',
            'file'=>'Log.log'
        ];

        $this->_config = array_merge($defaults, $options);

        switch($this->_config['type']) {
            case 'file':    
                $this->_file = $this->_config['file'];
                $this->file(date("m-d-Y H:i:s"));
                $this->_testCount = 0;
                break;
            default:
                throw new \InvalidArgumentException($this->_config['type'].' is not a valid Log type');
                break;
        }
    }

    public function file($content, $result='EMPTY')
    {
        $endline = "\r\n";
        $content = $this->_tapify($content, $result);

        print "<div>$content</div>";
        return file_put_contents($this->_file, $content.$endline, FILE_APPEND);
    }

    private function _tapify($content, $result) {
        $nextTest = $this->testCount+1;
        $prefix = 'ok '.$nextTest.' - ';
            
        if($result!=='EMPTY') {
                $this->testCount = $nextTest;
                $content = $prefix.$content;
            if(!$result) {
{'fraction_non_alphanumeric': 0.16085790884718498, 'fraction_numerical': 0.0015319800842589046, 'mean_word_length': 1.764021164021164, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, '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': '1381030', 'n_tokens_mistral': 764, 'n_tokens_neox': 734, 'n_words': 146}