* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Silex\Provider\Twig; use Pimple\Container; /** * Loads Twig extension runtimes via Pimple. * * @author Fabien Potencier */ class RuntimeLoader implements \Twig\RuntimeLoader\RuntimeLoaderInterface { private $container; private $mapping; public function __construct(Container $container, array $mapping) { $this->container = $container; $this->mapping = $mapping; } /** * {@inheritdoc} */ public function load($class) { if (isset($this->mapping[$class])) { return $this->container[$this->mapping[$class]]; } } }