| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | protected function getRawTwig($templatePath) { |
||
|
|
|||
| 16 | if ($this->twig === null) { |
||
| 17 | $loader = new \Twig_Loader_Filesystem($templatePath); |
||
| 18 | $this->twig = new \Twig_Environment($loader); |
||
| 19 | |||
| 20 | // $translator = $this->getServiceContainer()->getTranslator(); |
||
| 21 | |||
| 22 | // // translator function |
||
| 23 | // $trans = function($key, $params = [], $domain = null) use ($translator) { |
||
| 24 | // return $translator->trans($key, $params, $domain); |
||
| 25 | // }; |
||
| 26 | // $this->twig->addFunction(new \Twig_SimpleFunction('t', $trans)); |
||
| 27 | |||
| 28 | // firewall |
||
| 29 | $firewall = $this->getServiceContainer()->getFirewall(); |
||
| 30 | $this->twig->addFunction(new \Twig_SimpleFunction('hasPermission', function ($module, $action) use ($firewall) { |
||
| 31 | return $firewall->hasPermission($module, $action); |
||
| 32 | })); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $this->twig; |
||
| 36 | } |
||
| 37 | } |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.