/** * Dumps the service container to PHP code in the cache. * * @param ConfigCache $cache The config cache * @param ContainerBuilder $container The service container * @param string $class The name of the class to generate * @param string $baseClass The name of the container's base class * @param string $kernel The kernel that is initializing the container */ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass, KernelInterface $kernel) { // cache the container $dumper = new PhpDumper($container); if (class_exists('ProxyManager\\Configuration') && class_exists('Symfony\\Bridge\\ProxyManager\\LazyProxy\\PhpDumper\\ProxyDumper')) { $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); } $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath())); if (!$kernel->getConfig()->isDebug()) { $content = static::stripComments($content); } $cache->write($content, $container->getResources()); }