| Total Complexity | 5 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 50% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class MiscExtension extends \Twig_Extension |
||
| 8 | { |
||
| 9 | protected $container; |
||
| 10 | |||
| 11 | 32 | public function __construct(ContainerInterface $container) |
|
| 12 | { |
||
| 13 | 32 | $this->container = $container; |
|
| 14 | 32 | } |
|
| 15 | |||
| 16 | public function getFunctions() |
||
| 17 | { |
||
| 18 | return array( |
||
| 19 | new \Twig_SimpleFunction('serviceExists', array($this, 'serviceExists')), |
||
| 20 | new \Twig_SimpleFunction('getParameter', array($this, 'getParameter')), |
||
| 21 | ); |
||
| 22 | } |
||
| 23 | |||
| 24 | 13 | public function getParameter($parameter) |
|
| 25 | { |
||
| 26 | 13 | if ($this->container->hasParameter($parameter)) { |
|
| 27 | 13 | return $this->container->getParameter($parameter); |
|
| 28 | } else { |
||
| 29 | return ''; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | public function serviceExists($service) |
||
| 36 | } |
||
| 37 | } |
||
| 38 |