/**
  * @return ContainerInterface
  *
  * Initialize the application container: builds kernel services and parameters.
  *
  * It must inject:
  * - services:
  *     - kernel: the kernel
  * - parameters: (If handles parameter)
  *     - kernel.cache_dir: the cache directory (from $kernel->getConfig()->getCacheDir())
  *
  * It should inject specific environment variable as parameters.
  */
 public function initializeContainer(KernelInterface $kernel) : ContainerInterface
 {
     return new DefaultContainer($kernel, $kernel->getConfig()->getCacheDir());
 }
 /**
  * Builds the service container.
  *
  * @param  KernelInterface $kernel The kernel that is initializing the container
  * @return ContainerBuilder The compiled service container
  *
  * @throws \RuntimeException
  */
 protected function buildContainer(KernelInterface $kernel)
 {
     $dir = $kernel->getConfig()->getCacheDir();
     if (!is_dir($dir)) {
         if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
             throw new \RuntimeException(sprintf("Unable to create the cache directory (%s)\n", $dir));
         }
     } elseif (!is_writable($dir)) {
         throw new \RuntimeException(sprintf("Unable to write in the cache directory (%s)\n", $dir));
     }
     $container = $this->getContainerBuilder($kernel);
     $container->addObjectResource($this);
     $this->prepareContainer($container, $kernel);
     if (null !== ($cont = $this->registerContainerConfiguration($this->getContainerLoader($container)))) {
         $container->merge($cont);
     }
     return $container;
 }