<commit_before><?php

namespace Tapestry\Entities\Generators;

use Tapestry\Entities\Project;

class TaxonomyIndexGenerator extends FileGenerator
{
    public function generate(Project $project)
    {
        if (! $this->file->hasData('use')) {
            return $this->file; //@todo this should return a stripped version of the generator, otherwise you will get infinite loops?
        }

        $newFile = clone $this->file;
        $newFile->setData([
            'generator' => array_filter($this->file->getData('generator'), function ($value) {
                return $value !== 'TaxonomyIndexGenerator';
            }),
        ]);

        return $newFile;
    }
}<commit_msg>:bug: Removed possibility of infinite loop and completed a todo for #61<commit_after><?php

namespace Tapestry\Entities\Generators;

use Tapestry\Entities\Project;

class TaxonomyIndexGenerator extends FileGenerator
{
    public function generate(Project $project)
    {
        if (! $this->file->hasData('use')) {
            $this->file->setData([
                'generator' => array_filter($this->file->getData('generator'), function ($value) {
                    return $value !== 'TaxonomyIndexGenerator';
                }),
            ]);
            return $this->file;
        }

        $newFile = clone $this->file;
        $newFile->setData([
            'generator' => array_filter($this->file->getData('generator'), function ($value) {
                return $value !== 'TaxonomyIndexGenerator';
            }),
        ]);

        return $newFile;
    }
}
{'fraction_non_alphanumeric': 0.133888532991672, 'fraction_numerical': 0.0012812299807815502, 'mean_word_length': 2.373650107991361, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '2268729', 'n_tokens_mistral': 411, 'n_tokens_neox': 404, 'n_words': 95}