4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 use Psr\Container\ContainerInterface;
15 * Lazily loads Twig runtime implementations from a PSR-11 container.
17 * Note that the runtime services MUST use their class names as identifiers.
19 * @author Fabien Potencier <fabien@symfony.com>
20 * @author Robin Chalas <robin.chalas@gmail.com>
22 class Twig_ContainerRuntimeLoader implements Twig_RuntimeLoaderInterface
26 public function __construct(ContainerInterface $container)
28 $this->container = $container;
31 public function load($class)
33 if ($this->container->has($class)) {
34 return $this->container->get($class);