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