<commit_before><?php

/*
 * This file is part of the h4cc/AliceFixtureBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace h4cc\AliceFixturesBundle\Command;

use h4cc\AliceFixturesBundle\Fixtures\FixtureSetInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Class LoadSetsCommand
 *
 * @author <NAME> <<EMAIL>>
 */
class LoadSetsCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
          ->setName('h4cc_alice_fixtures:load:sets')
          ->setDescription('Load fixture sets using alice and faker.')
          ->addArgument('sets', InputArgument::IS_ARRAY, 'List of path to fixture sets to import.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $sets = $input->getArgument('sets');

        if (!$sets) {
            $output->writeln("No sets to load");
        }

        // Check if all set files exist
        foreach ($sets as $file) {
            if (!file_exists($file)) {
                throw new \InvalidArgumentException("FixtureSet file does not exist: '$file'.");
            }
        }

        /**
         * @var $manager \h4cc\AliceFixturesBundle\Fixtures\FixtureManager
         */
        $manager = $this->getContainer()->get('h4cc_alice_fixtures.manager');

        foreach ($sets as $file) {
            $output->write("Loading file '$file' ... ");

            // The file should return a FixtureSetInterface
            $set = include($file);

            if (!$set || !($set instanceof FixtureSetInterface)) {
                throw new \InvalidArgumentException("File '$file' does not return a FixtureSetInterface.");
            }

            $entities = $manager->load($set);

            $output->writeln("loaded " . count($entities) . " entities ... done.");
        }
    }
}<commit_msg>Isolate include to avoid variable conflicts<commit_after><?php

/*
 * This file is part of the h4cc/AliceFixtureBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace h4cc\AliceFixturesBundle\Command;

use h4cc\AliceFixturesBundle\Fixtures\FixtureSetInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Class LoadSetsCommand
 *
 * @author <NAME> <<EMAIL>>
 */
class LoadSetsCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
          ->setName('h4cc_alice_fixtures:load:sets')
          ->setDescription('Load fixture sets using alice and faker.')
          ->addArgument('sets', InputArgument::IS_ARRAY, 'List of path to fixture sets to import.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $sets = $input->getArgument('sets');

        if (!$sets) {
            $output->writeln("No sets to load");
        }

        // Check if all set files exist
        foreach ($sets as $file) {
            if (!file_exists($file)) {
                throw new \InvalidArgumentException("FixtureSet file does not exist: '$file'.");
            }
        }

        /**
         * @var $manager \h4cc\AliceFixturesBundle\Fixtures\FixtureManager
         */
        $manager = $this->getContainer()->get('h4cc_alice_fixtures.manager');

        foreach ($sets as $file) {
            $output->write("Loading file '$file' ... ");

            // The file should return a FixtureSetInterface
            $set = $this->loadSet($file);

            if (!$set || !($set instanceof FixtureSetInterface)) {
                throw new \InvalidArgumentException("File '$file' does not return a FixtureSetInterface.");
            }

            $entities = $manager->load($set);

            $output->writeln("loaded " . count($entities) . " entities ... done.");
        }
    }
    
    protected function loadSet($file)
    {
        return include $file;
    }
}
{'fraction_non_alphanumeric': 0.12364130434782608, 'fraction_numerical': 0.002717391304347826, 'mean_word_length': 2.602773246329527, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 36, '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': '5600294', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1195, 'n_words': 307}