<commit_before><?php
namespace Oro\Bundle\DataFlowBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
 * CompilerPass Connector
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/MIT MIT
 *
 */
class ConnectorCompilerPass implements CompilerPassInterface
{

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('oro_dataflow.connectors')) {
            return;
        }

        // get registry
        $definition = $container->getDefinition('oro_dataflow.connectors');

        // get jobs
        $taggedServices = $container->findTaggedServiceIds('oro_dataflow_job');

        // for each tagged service, call addConnector method on dataflow.connectors
        foreach ($taggedServices as $id => $tagAttributes) {
            foreach ($tagAttributes as $attributes) {
                // retrieve reference to relevant connector and add job into
                $connectorId = $attributes['connector'];
                if (!$container->hasDefinition($connectorId)) {
                    throw new InvalidArgumentException(
                        sprintf('The connector service definition "%s" does not exist.', $connectorId)
                    );
                }
                $definition->addMethodCall(
                    'addJobToConnector',
                    array($connectorId, new Reference($connectorId), $id, new Reference($id))
                );
            }
        }
    }
}<commit_msg>BAP-43 : rename variables to be more explicit and remove useless comments<commit_after><?php
namespace Oro\Bundle\DataFlowBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
 * CompilerPass Connector
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 Akeneo SAS (http://www.<EMAIL>)
 * @license   http://opensource.org/licenses/MIT MIT
 *
 */
class ConnectorCompilerPass implements CompilerPassInterface
{

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('oro_dataflow.connectors')) {
            return;
        }

        $registryDefinition = $container->getDefinition('oro_dataflow.connectors');
        $taggedJobServices = $container->findTaggedServiceIds('oro_dataflow_job');

        foreach ($taggedJobServices as $jobId => $tagAttributes) {
            foreach ($tagAttributes as $attributes) {
                $connectorId = $attributes['connector'];
                if (!$container->hasDefinition($connectorId)) {
                    throw new InvalidArgumentException(
                        sprintf('The connector service definition "%s" does not exist.', $connectorId)
                    );
                }
                $registryDefinition->addMethodCall(
                    'addJobToConnector',
                    array($connectorId, new Reference($connectorId), $jobId, new Reference($jobId))
                );
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.10551491277433878, 'fraction_numerical': 0.0028137310073157004, 'mean_word_length': 2.590909090909091, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3867200', 'n_tokens_mistral': 893, 'n_tokens_neox': 850, 'n_words': 178}