You are here

protected function Kernel::buildContainer in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Kernel.php \Symfony\Component\HttpKernel\Kernel::buildContainer()

Builds the service container.

Return value

ContainerBuilder The compiled service container

Throws

\RuntimeException

1 call to Kernel::buildContainer()
Kernel::initializeContainer in vendor/symfony/http-kernel/Kernel.php
Initializes the service container.

File

vendor/symfony/http-kernel/Kernel.php, line 580

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function buildContainer() {
  foreach (array(
    'cache' => $this
      ->getCacheDir(),
    'logs' => $this
      ->getLogDir(),
  ) as $name => $dir) {
    if (!is_dir($dir)) {
      if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
        throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
      }
    }
    elseif (!is_writable($dir)) {
      throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
    }
  }
  $container = $this
    ->getContainerBuilder();
  $container
    ->addObjectResource($this);
  $this
    ->prepareContainer($container);
  if (null !== ($cont = $this
    ->registerContainerConfiguration($this
    ->getContainerLoader($container)))) {
    $container
      ->merge($cont);
  }
  $container
    ->addCompilerPass(new AddClassesToCachePass($this));
  $container
    ->addResource(new EnvParametersResource('SYMFONY__'));
  return $container;
}