You are here

private function PhpDumper::getExpressionLanguage in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::getExpressionLanguage()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php, line 1505

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function getExpressionLanguage() {
  if (null === $this->expressionLanguage) {
    if (!class_exists('Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) {
      throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
    }
    $providers = array_merge($this->container
      ->getExpressionLanguageProviders(), $this->expressionLanguageProviders);
    $this->expressionLanguage = new ExpressionLanguage(null, $providers);
    if ($this->container
      ->isTrackingResources()) {
      foreach ($providers as $provider) {
        $this->container
          ->addObjectResource($provider);
      }
    }
  }
  return $this->expressionLanguage;
}