<commit_before><?php
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2016, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\ContentBundle\DependencyInjection\Compiler;

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

/**
 * Add widget factories to widget pool compiler pass
 */
class AddWidgetFactoriesPass implements CompilerPassInterface
{
    const POOL_ID = 'darvin_content.widget.pool';

    const TAG_WIDGET_FACTORY = 'darvin_content.widget_factory';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(self::POOL_ID)) {
            return;
        }

        $poolDefinition = $container->getDefinition(self::POOL_ID);

        foreach ($container->findTaggedServiceIds(self::TAG_WIDGET_FACTORY) as $id => $tags) {
            $reference = new Reference($id);

            foreach ($tags as $tag) {
                $poolDefinition->addMethodCall('addWidgetFactory', [
                    $reference,
                ]);
            }
        }
    }
}<commit_msg>Fix CS.<commit_after><?php
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2016, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\ContentBundle\DependencyInjection\Compiler;

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

/**
 * Add widget factories to widget pool compiler pass
 */
class AddWidgetFactoriesPass implements CompilerPassInterface
{
    const POOL_ID = 'darvin_content.widget.pool';

    const TAG_WIDGET_FACTORY = 'darvin_content.widget_factory';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(self::POOL_ID)) {
            return;
        }

        $poolDefinition = $container->getDefinition(self::POOL_ID);

        foreach ($container->findTaggedServiceIds(self::TAG_WIDGET_FACTORY) as $id => $attr) {
            $poolDefinition->addMethodCall('addWidgetFactory', [
                new Reference($id),
            ]);
        }
    }
}
{'fraction_non_alphanumeric': 0.10955269143290372, 'fraction_numerical': 0.003032600454890068, 'mean_word_length': 3.1955484896661366, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '5136420', 'n_tokens_mistral': 735, 'n_tokens_neox': 717, 'n_words': 157}