You are here

public function ExpressionLanguageProvider::getFunctions in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php \Symfony\Component\DependencyInjection\ExpressionLanguageProvider::getFunctions()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php, line 27

Class

ExpressionLanguageProvider
Define some ExpressionLanguage functions.

Namespace

Symfony\Component\DependencyInjection

Code

public function getFunctions() {
  return array(
    new ExpressionFunction('service', function ($arg) {
      return sprintf('$this->get(%s)', $arg);
    }, function (array $variables, $value) {
      return $variables['container']
        ->get($value);
    }),
    new ExpressionFunction('parameter', function ($arg) {
      return sprintf('$this->getParameter(%s)', $arg);
    }, function (array $variables, $value) {
      return $variables['container']
        ->getParameter($value);
    }),
  );
}