<commit_before><?php

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class Inviqa_SymfonyContainer_Model_ControllerInjectionCompilerPass implements CompilerPassInterface
{
    const TAG_NAME = 'mage.controller';

    const CONTROLLERS_SERVICE_ID = 'controllers';

    /**
     * Adds requested store configuration as an argument to the services
     *
     * @param ContainerBuilder $container
     */
    public function process(ContainerBuilder $container)
    {
        $taggedServices = $container->findTaggedServiceIds(
            self::TAG_NAME
        );

        $controllersObject = (object) array(
            self::CONTROLLERS_SERVICE_ID => array()
        );

        foreach ($taggedServices as $id => $tag) {

            $definition = $container->findDefinition($id);

            $controllersObject->controllers[$definition->getClass()] = array();
            for ($arg=0; $arg < count($definition->getArguments()); $arg++) {
                $controllersObject->controllers[$definition->getClass()][$arg] =  $definition->getArgument($arg);
            }
        }

        $container->set(self::CONTROLLERS_SERVICE_ID, $controllersObject);
    }
}
<commit_msg>Refactor<commit_after><?php

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class Inviqa_SymfonyContainer_Model_ControllerInjectionCompilerPass implements CompilerPassInterface
{
    const TAG_NAME = 'mage.controller';

    const CONTROLLERS_SERVICE_ID = 'controllers';

    /**
     * @param ContainerBuilder $container
     */
    public function process(ContainerBuilder $container)
    {
        $taggedServices = $container->findTaggedServiceIds(
            self::TAG_NAME
        );

        $controllersObject = (object) array(
            self::CONTROLLERS_SERVICE_ID => array()
        );

        foreach ($taggedServices as $id => $tag) {

            $this->addDefinitionArguments($container->findDefinition($id), $controllersObject);
        }

        $container->set(self::CONTROLLERS_SERVICE_ID, $controllersObject);
    }

    /**
     * @param $definition
     * @param $controllersObject
     */
    private function addDefinitionArguments(Definition $definition, stdClass $controllersObject)
    {
        $controllersObject->controllers[$definition->getClass()] = array();

        for ($arg = 0; $arg < count($definition->getArguments()); $arg++) {
            $controllersObject->controllers[$definition->getClass()][$arg] = $definition->getArgument($arg);
        }
    }
}

{'fraction_non_alphanumeric': 0.11630434782608695, 'fraction_numerical': 0.0007246376811594203, 'mean_word_length': 3.4246794871794872, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '5714954', 'n_tokens_mistral': 740, 'n_tokens_neox': 726, 'n_words': 121}