PHP 8.3.30
Preview: LazyLoadingFragmentHandler.php Size: 1.38 KB
/home/getspomw/.trash/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.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 Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;

/**
 * Lazily loads fragment renderers from the dependency injection container.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class LazyLoadingFragmentHandler extends FragmentHandler
{
    /**
     * @var array<string, bool>
     */
    private array $initialized = [];

    public function __construct(
        private ContainerInterface $container,
        RequestStack $requestStack,
        bool $debug = false,
    ) {
        parent::__construct($requestStack, [], $debug);
    }

    public function render(string|ControllerReference $uri, string $renderer = 'inline', array $options = []): ?string
    {
        if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) {
            $this->addRenderer($this->container->get($renderer));
            $this->initialized[$renderer] = true;
        }

        return parent::render($uri, $renderer, $options);
    }
}

Directory Contents

Dirs: 0 × Files: 13

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
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).