PHP 8.3.31
Preview: FragmentRendererPass.php Size: 2.04 KB
/home/getspomw/royalsquad.us/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpKernel\DependencyInjection;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;

/**
 * Adds services tagged kernel.fragment_renderer as HTTP content rendering strategies.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class FragmentRendererPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container): void
    {
        if (!$container->hasDefinition('fragment.handler')) {
            return;
        }

        $definition = $container->getDefinition('fragment.handler');
        $renderers = [];
        foreach ($container->findTaggedServiceIds('kernel.fragment_renderer', true) as $id => $tags) {
            $def = $container->getDefinition($id);
            $class = $container->getParameterBag()->resolveValue($def->getClass());

            if (!$r = $container->getReflectionClass($class)) {
                throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
            }
            if (!$r->isSubclassOf(FragmentRendererInterface::class)) {
                throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class));
            }

            foreach ($tags as $tag) {
                $renderers[$tag['alias']] = new Reference($id);
            }
        }

        $definition->replaceArgument(0, ServiceLocatorTagPass::register($container, $renderers));
    }
}

Directory Contents

Dirs: 0 × Files: 14

Name Size Perms Modified Actions
4.27 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.23 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
2.99 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
15.83 KB lrw-r--r-- 2026-04-27 10:18:53
Edit Download
1.63 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
2.04 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.38 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.46 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.10 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
11.73 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.36 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
2.71 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
2.09 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download
1.59 KB lrw-rw-rw- 2025-09-17 06:53:21
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).