Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TemplateEngineFactory.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\View;
7 
9 
14 {
20  protected $objectManager;
21 
27  protected $engines;
28 
36  {
37  $this->objectManager = $objectManager;
38  $this->engines = $engines;
39  }
40 
49  public function create($name)
50  {
51  if (!isset($this->engines[$name])) {
52  throw new \InvalidArgumentException("Unknown template engine type: '{$name}'.");
53  }
54  $engineClass = $this->engines[$name];
55  $engineInstance = $this->objectManager->create($engineClass);
56  if (!$engineInstance instanceof \Magento\Framework\View\TemplateEngineInterface) {
57  throw new \UnexpectedValueException("{$engineClass} has to implement the template engine interface.");
58  }
59  return $engineInstance;
60  }
61 }
__construct(ObjectManagerInterface $objectManager, array $engines)
if(!isset($_GET['name'])) $name
Definition: log.php:14