*/ final class Kernel extends BaseKernel { use MicroKernelTrait; private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; public function getCacheDir(): string { return dirname(__DIR__).'/var/cache/'.$this->environment; } public function getLogDir(): string { return dirname(__DIR__).'/var/logs'; } public function registerBundles(): iterable { $contents = require dirname(__DIR__).'/etc/bundles.php'; foreach ($contents as $class => $envs) { if (isset($envs['all']) || isset($envs[$this->environment])) { yield new $class(); } } } protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $confDir = dirname(__DIR__).'/etc'; $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob'); if (is_dir($confDir.'/packages/'.$this->environment)) { $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); } $loader->load($confDir.'/container'.self::CONFIG_EXTS, 'glob'); } protected function configureRoutes(RouteCollectionBuilder $routes): void { $confDir = dirname(__DIR__).'/etc'; if (is_dir($confDir.'/routing/')) { $routes->import($confDir.'/routing/*'.self::CONFIG_EXTS, '/', 'glob'); } if (is_dir($confDir.'/routing/'.$this->environment)) { $routes->import($confDir.'/routing/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); } $routes->import($confDir.'/routing'.self::CONFIG_EXTS, '/', 'glob'); } }