Security update to Drupal 8.4.6
[yaffs-website] / vendor / twig / twig / lib / Twig / ContainerRuntimeLoader.php
1 <?php
2
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 use Psr\Container\ContainerInterface;
13
14 /**
15  * Lazily loads Twig runtime implementations from a PSR-11 container.
16  *
17  * Note that the runtime services MUST use their class names as identifiers.
18  *
19  * @author Fabien Potencier <fabien@symfony.com>
20  * @author Robin Chalas <robin.chalas@gmail.com>
21  */
22 class Twig_ContainerRuntimeLoader implements Twig_RuntimeLoaderInterface
23 {
24     private $container;
25
26     public function __construct(ContainerInterface $container)
27     {
28         $this->container = $container;
29     }
30
31     public function load($class)
32     {
33         if ($this->container->has($class)) {
34             return $this->container->get($class);
35         }
36     }
37 }
38
39 class_alias('Twig_ContainerRuntimeLoader', 'Twig\RuntimeLoader\ContainerRuntimeLoader', false);