$62 GRAYBYTE WORDPRESS FILE MANAGER $68

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/php53/usr/share/pear/Symfony/Component/Templating/

HOME
Current File : /opt/alt/php53/usr/share/pear/Symfony/Component/Templating//DelegatingEngine.php
<?php

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

namespace Symfony\Component\Templating;

/**
 * DelegatingEngine selects an engine for a given template.
 *
 * @author Fabien Potencier <[email protected]>
 *
 * @api
 */
class DelegatingEngine implements EngineInterface, StreamingEngineInterface
{
    /**
     * @var EngineInterface[]
     */
    protected $engines = array();

    /**
     * Constructor.
     *
     * @param EngineInterface[] $engines An array of EngineInterface instances to add
     *
     * @api
     */
    public function __construct(array $engines = array())
    {
        foreach ($engines as $engine) {
            $this->addEngine($engine);
        }
    }

    /**
     * {@inheritdoc}
     *
     * @api
     */
    public function render($name, array $parameters = array())
    {
        return $this->getEngine($name)->render($name, $parameters);
    }

    /**
     * {@inheritdoc}
     *
     * @api
     */
    public function stream($name, array $parameters = array())
    {
        $engine = $this->getEngine($name);
        if (!$engine instanceof StreamingEngineInterface) {
            throw new \LogicException(sprintf('Template "%s" cannot be streamed as the engine supporting it does not implement StreamingEngineInterface.', $name));
        }

        $engine->stream($name, $parameters);
    }

    /**
     * {@inheritdoc}
     *
     * @api
     */
    public function exists($name)
    {
        return $this->getEngine($name)->exists($name);
    }

    /**
     * Adds an engine.
     *
     * @param EngineInterface $engine An EngineInterface instance
     *
     * @api
     */
    public function addEngine(EngineInterface $engine)
    {
        $this->engines[] = $engine;
    }

    /**
     * {@inheritdoc}
     *
     * @api
     */
    public function supports($name)
    {
        try {
            $this->getEngine($name);
        } catch (\RuntimeException $e) {
            return false;
        }

        return true;
    }

    /**
     * Get an engine able to render the given template.
     *
     * @param string|TemplateReferenceInterface $name A template name or a TemplateReferenceInterface instance
     *
     * @return EngineInterface The engine
     *
     * @throws \RuntimeException if no engine able to work with the template is found
     *
     * @api
     */
    public function getEngine($name)
    {
        foreach ($this->engines as $engine) {
            if ($engine->supports($name)) {
                return $engine;
            }
        }

        throw new \RuntimeException(sprintf('No engine is able to work with the template "%s".', $name));
    }
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.55 PM
root / root
0755
Asset
--
3 Mar 2024 10.55 PM
root / root
0755
Helper
--
3 Mar 2024 10.55 PM
root / root
0755
Loader
--
3 Mar 2024 10.55 PM
root / root
0755
Storage
--
3 Mar 2024 10.55 PM
root / root
0755
DebuggerInterface.php
0.678 KB
18 Dec 2019 11.20 AM
root / root
0644
DelegatingEngine.php
2.769 KB
18 Dec 2019 11.20 AM
root / root
0644
EngineInterface.php
2.177 KB
18 Dec 2019 11.20 AM
root / root
0644
PhpEngine.php
15.368 KB
18 Dec 2019 11.20 AM
root / root
0644
StreamingEngineInterface.php
1.001 KB
18 Dec 2019 11.20 AM
root / root
0644
TemplateNameParser.php
0.965 KB
18 Dec 2019 11.20 AM
root / root
0644
TemplateNameParserInterface.php
0.792 KB
18 Dec 2019 11.20 AM
root / root
0644
TemplateReference.php
1.872 KB
18 Dec 2019 11.20 AM
root / root
0644
TemplateReferenceInterface.php
1.933 KB
18 Dec 2019 11.20 AM
root / root
0644
autoloader.php
0.332 KB
18 Dec 2019 11.20 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF