ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_FactoryRuntimeLoader Class Reference

Lazy loads the runtime implementations for a Twig element. More...

+ Inheritance diagram for Twig_FactoryRuntimeLoader:
+ Collaboration diagram for Twig_FactoryRuntimeLoader:

Public Member Functions

 __construct ($map=array())
 
 load ($class)
 Creates the runtime implementation of a Twig element (filter/function/test). More...
 

Private Attributes

 $map
 

Detailed Description

Lazy loads the runtime implementations for a Twig element.

Author
Robin Chalas robin.nosp@m..cha.nosp@m.las@g.nosp@m.mail.nosp@m..com

Definition at line 17 of file FactoryRuntimeLoader.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_FactoryRuntimeLoader::__construct (   $map = array())
Parameters
array$mapAn array where keys are class names and values factory callables

Definition at line 24 of file FactoryRuntimeLoader.php.

References $map.

25  {
26  $this->map = $map;
27  }

Member Function Documentation

◆ load()

Twig_FactoryRuntimeLoader::load (   $class)

Creates the runtime implementation of a Twig element (filter/function/test).

Parameters
string$classA runtime class
Returns
object|null The runtime instance or null if the loader does not know how to create the runtime for this class

Implements Twig_RuntimeLoaderInterface.

Definition at line 29 of file FactoryRuntimeLoader.php.

30  {
31  if (isset($this->map[$class])) {
32  $runtimeFactory = $this->map[$class];
33 
34  return $runtimeFactory();
35  }
36  }

Field Documentation

◆ $map

Twig_FactoryRuntimeLoader::$map
private

Definition at line 19 of file FactoryRuntimeLoader.php.

Referenced by __construct().


The documentation for this class was generated from the following file: