You are here

class ExpressionLanguageProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/ExpressionLanguageProvider.php \Symfony\Component\DependencyInjection\ExpressionLanguageProvider

Define some ExpressionLanguage functions.

To get a service, use service('request'). To get a parameter, use parameter('kernel.debug').

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

  • class \Symfony\Component\DependencyInjection\ExpressionLanguageProvider implements \Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface

Expanded class hierarchy of ExpressionLanguageProvider

File

vendor/symfony/dependency-injection/ExpressionLanguageProvider.php, line 25

Namespace

Symfony\Component\DependencyInjection
View source
class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface {
  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);
      }),
    );
  }

}

Members