class ContainerRuntimeLoader
Lazily loads Twig runtime implementations from a PSR-11 container.
Note that the runtime services MUST use their class names as identifiers.
@author Fabien Potencier <fabien@symfony.com> @author Robin Chalas <robin.chalas@gmail.com>
Hierarchy
- class \Twig\RuntimeLoader\ContainerRuntimeLoader implements \Twig\RuntimeLoader\RuntimeLoaderInterface
Expanded class hierarchy of ContainerRuntimeLoader
File
-
vendor/
twig/ twig/ src/ RuntimeLoader/ ContainerRuntimeLoader.php, line 24
Namespace
Twig\RuntimeLoaderView source
class ContainerRuntimeLoader implements RuntimeLoaderInterface {
public function __construct(ContainerInterface $container) {
}
public function load(string $class) {
return $this->container
->has($class) ? $this->container
->get($class) : null;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ContainerRuntimeLoader::load | public | function | Creates the runtime implementation of a Twig element (filter/function/test). | Overrides RuntimeLoaderInterface::load |
ContainerRuntimeLoader::__construct | public | function |