vendor/shopware/core/Profiling/Profiling.php line 18

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. /**
  13.  * @internal
  14.  */
  15. class Profiling extends Bundle
  16. {
  17.     public function getTemplatePriority(): int
  18.     {
  19.         return -2;
  20.     }
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function build(ContainerBuilder $container): void
  25.     {
  26.         /** @var string $environment */
  27.         $environment $container->getParameter('kernel.environment');
  28.         parent::build($container);
  29.         $this->buildConfig($container$environment);
  30.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/DependencyInjection/'));
  31.         $loader->load('services.xml');
  32.     }
  33.     public function boot(): void
  34.     {
  35.         parent::boot();
  36.         // The profiler registers all profiler integrations in the constructor
  37.         // Therefor we need to get the service once to initialize it
  38.         $this->container->get(Profiler::class);
  39.     }
  40.     private function buildConfig(ContainerBuilder $containerstring $environment): void
  41.     {
  42.         $locator = new FileLocator('Resources/config');
  43.         $resolver = new LoaderResolver([
  44.             new YamlFileLoader($container$locator),
  45.             new GlobFileLoader($container$locator),
  46.         ]);
  47.         $configLoader = new DelegatingLoader($resolver);
  48.         $confDir $this->getPath() . '/Resources/config';
  49.         $configLoader->load($confDir '/{packages}/*' Kernel::CONFIG_EXTS'glob');
  50.         $configLoader->load($confDir '/{packages}/' $environment '/*' Kernel::CONFIG_EXTS'glob');
  51.     }
  52. }