<commit_before><?php

namespace Karma;

use Karma\VCS\Vcs;
use Psr\Log\NullLogger;
use Gaufrette\Adapter\iterator_to_array;

class VcsHandler
{
    use Logging\LoggerAware;
    
    private
        $vcs,
        $finder,
        $suffix;
    
    public function __construct(Vcs $vcs, Finder $finder)
    {
        $this->logger = new NullLogger();
        $this->vcs = $vcs;
        $this->finder = $finder; 
        $this->suffix = Application::DEFAULT_DISTFILE_SUFFIX;
    }

    public function setSuffix($suffix)
    {
        $this->suffix = $suffix;
    
        return $this;
    }

    public function execute()
    {
        $it = $this->finder->findFiles("~$this->suffix$~");
        $suffixLength = strlen($this->suffix);
        
        foreach($it as $distFile)
        {
            $targetFile = substr($distFile, 0, $suffixLength * -1);
            
            if($this->vcs->isTracked($targetFile))
            {
                $this->vcs->untrackFile($targetFile);
            }
            
            if($this->vcs->isIgnored($targetFile) === false)
            {
                $this->vcs->ignoreFile($targetFile);
            }
        }
    }
}<commit_msg>Add log messages into VcsHandler<commit_after><?php

namespace Karma;

use Karma\VCS\Vcs;
use Psr\Log\NullLogger;
use Gaufrette\Adapter\iterator_to_array;

class VcsHandler
{
    use Logging\LoggerAware;
    
    private
        $vcs,
        $finder,
        $suffix;
    
    public function __construct(Vcs $vcs, Finder $finder)
    {
        $this->logger = new NullLogger();
        $this->vcs = $vcs;
        $this->finder = $finder; 
        $this->suffix = Application::DEFAULT_DISTFILE_SUFFIX;
    }

    public function setSuffix($suffix)
    {
        $this->suffix = $suffix;
    
        return $this;
    }

    public function execute()
    {
        $it = $this->finder->findFiles("~$this->suffix$~");
        $suffixLength = strlen($this->suffix);
        
        foreach($it as $distFile)
        {
            $targetFile = substr($distFile, 0, $suffixLength * -1);
            
            if($this->vcs->isTracked($targetFile))
            {
                $this->logger->info("Untrack $targetFile");
                $this->vcs->untrackFile($targetFile);
            }
            
            if($this->vcs->isIgnored($targetFile) === false)
            {
                $this->logger->info("Ignore $targetFile");
                $this->vcs->ignoreFile($targetFile);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.13875598086124402, 'fraction_numerical': 0.001594896331738437, 'mean_word_length': 1.7420765027322405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '4117466', 'n_tokens_mistral': 800, 'n_tokens_neox': 768, 'n_words': 126}