| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Zored\TelegramBundle; |
||
| 6 | |||
| 7 | use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
||
| 8 | use Symfony\Component\Config\Loader\LoaderInterface; |
||
| 9 | use Symfony\Component\Config\Resource\FileResource; |
||
| 10 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
| 11 | use Symfony\Component\HttpKernel\Kernel as BaseKernel; |
||
| 12 | use Symfony\Component\Routing\RouteCollectionBuilder; |
||
| 13 | |||
| 14 | class Kernel extends BaseKernel |
||
| 15 | { |
||
| 16 | use MicroKernelTrait; |
||
| 17 | |||
| 18 | private const CONFIG_EXTS = '.{php,xml,yaml}'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | public function getCacheDir(): string |
||
| 24 | { |
||
| 25 | return $this->getProjectDir() . '/var/cache/' . $this->environment; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | public function getLogDir(): string |
||
| 32 | { |
||
| 33 | return $this->getProjectDir() . '/var/log'; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | public function registerBundles(): iterable |
||
| 40 | { |
||
| 41 | $contents = require $this->getProjectDir() . '/config/bundles.php'; |
||
| 42 | foreach ($contents as $class => $envs) { |
||
| 43 | if (isset($envs['all']) || isset($envs[$this->environment])) { |
||
| 44 | yield new $class(); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void |
||
| 53 | { |
||
| 54 | $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php')); |
||
| 55 | $container->setParameter('container.autowiring.strict_mode', true); |
||
| 56 | $container->setParameter('container.dumper.inline_class_loader', true); |
||
| 57 | $confDir = $this->getProjectDir() . '/config'; |
||
| 58 | |||
| 59 | $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); |
||
| 60 | $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); |
||
| 61 | $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); |
||
| 62 | $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | protected function configureRoutes(RouteCollectionBuilder $routes): void |
||
|
0 ignored issues
–
show
|
|||
| 69 | { |
||
| 70 | } |
||
| 71 | } |
||
| 72 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.