| Conditions | 3 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function createInstance($templatePath) |
||
| 33 | { |
||
| 34 | $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($templatePath)); |
||
| 35 | |||
| 36 | try { |
||
| 37 | $extension = $this->configDAO->findConfig($templatePath, 'extension'); |
||
| 38 | foreach ($extension as $extensionName => $extension) { |
||
| 39 | $twig->addGlobal($extensionName, new $extension); |
||
| 40 | } |
||
| 41 | } catch (\InvalidArgumentException $e) { |
||
| 42 | // Nothing to do |
||
| 43 | } |
||
| 44 | |||
| 45 | return $twig; |
||
| 46 | } |
||
| 47 | } |
||
| 48 |