<commit_before><?php

namespace Oro\Bundle\EntityConfigBundle\DependencyInjection\Compiler;

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

use Oro\Bundle\EntityConfigBundle\Exception\RuntimeException;

class ServiceLinkPass implements CompilerPassInterface
{
    const TAG_NAME = 'oro_service_link';

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

        foreach ($tags as $id => $tag) {
            /** @var Definition $serviceLinkDef */
            $serviceLinkDef = $container->getDefinition($id);

            if (!isset($tag[0]['service'])) {
                throw new RuntimeException(
                    sprintf("Tag '%s' for service '%s' doesn't have required param 'service'", self::TAG_NAME, $id)
                );
            }

            $serviceId = $tag[0]['service'];
            $isOptional = false;
            if (strpos($serviceId, '?') === 0) {
                $serviceId = substr($serviceId, 1);
                $isOptional = true;
            }

            if (!$isOptional && !$container->hasDefinition($serviceId)) {
                throw new RuntimeException(
                    sprintf(
                        'Target service "%s" is undefined. The service link "%s" with tag "%s" and tag-service "%s"',
                        $serviceId,
                        $id,
                        self::TAG_NAME,
                        $serviceId
                    )
                );
            }

            $serviceLinkDef->setClass('Oro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceLink');
            $serviceLinkDef->setArguments(array(new Reference('service_container'), $serviceId, $isOptional));
        }
    }
}
<commit_msg>BAP-1443: Disable existed ACL<commit_after><?php

namespace Oro\Bundle\EntityConfigBundle\DependencyInjection\Compiler;

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

use Oro\Bundle\EntityConfigBundle\Exception\RuntimeException;

class ServiceLinkPass implements CompilerPassInterface
{
    const TAG_NAME = 'oro_service_link';

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

        foreach ($tags as $id => $tag) {
            /** @var Definition $serviceLinkDef */
            $serviceLinkDef = $container->getDefinition($id);

            if (!isset($tag[0]['service'])) {
                throw new RuntimeException(
                    sprintf("Tag '%s' for service '%s' doesn't have required param 'service'", self::TAG_NAME, $id)
                );
            }

            $serviceId = $tag[0]['service'];
            $isOptional = false;
            if (strpos($serviceId, '?') === 0) {
                $serviceId = substr($serviceId, 1);
                $isOptional = true;
            }

            if ($container->hasDefinition($serviceId)) {
                // the service we are referred to must be public
                $serviceDef = $container->getDefinition($serviceId);
                if (!$serviceDef->isPublic()) {
                    $serviceDef->setPublic(true);
                }
            } elseif (!$isOptional) {
                throw new RuntimeException(
                    sprintf(
                        'Target service "%s" is undefined. The service link "%s" with tag "%s" and tag-service "%s"',
                        $serviceId,
                        $id,
                        self::TAG_NAME,
                        $serviceId
                    )
                );
            }

            $serviceLinkDef->setClass('Oro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceLink');
            $serviceLinkDef->setArguments(array(new Reference('service_container'), $serviceId, $isOptional));
        }
    }
}

{'fraction_non_alphanumeric': 0.11564467241781301, 'fraction_numerical': 0.002797854977850315, 'mean_word_length': 2.0126404494382024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '7593543', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1055, 'n_words': 212}