platform/src/Core/Profiling/Profiling.php line 15

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Profiling;
  3. use Shopware\Core\Framework\Bundle;
  4. use Shopware\Core\Kernel;
  5. use Symfony\Component\Config\FileLocator;
  6. use Symfony\Component\Config\Loader\DelegatingLoader;
  7. use Symfony\Component\Config\Loader\LoaderResolver;
  8. use Symfony\Component\DependencyInjection\ContainerBuilder;
  9. use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
  10. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  11. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  12. class Profiling extends Bundle
  13. {
  14.     /**
  15.      * {@inheritdoc}
  16.      */
  17.     public function build(ContainerBuilder $container): void
  18.     {
  19.         parent::build($container);
  20.         $environment $container->getParameter('kernel.environment');
  21.         $this->buildConfig($container$environment);
  22.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/DependencyInjection/'));
  23.         $loader->load('services.xml');
  24.     }
  25.     private function buildConfig(ContainerBuilder $container$environment): void
  26.     {
  27.         $locator = new FileLocator('Resources/config');
  28.         $resolver = new LoaderResolver([
  29.             new YamlFileLoader($container$locator),
  30.             new GlobFileLoader($container$locator),
  31.         ]);
  32.         $configLoader = new DelegatingLoader($resolver);
  33.         $confDir $this->getPath() . '/Resources/config';
  34.         $configLoader->load($confDir '/{packages}/*' Kernel::CONFIG_EXTS'glob');
  35.         $configLoader->load($confDir '/{packages}/' $environment '/*' Kernel::CONFIG_EXTS'glob');
  36.     }
  37. }