Repository navigation
Expand file tree
/
Copy pathFopKernel.php
More file actions
66 lines (56 loc) · 2.42 KB
/
Copy pathFopKernel.php
File metadata and controls
66 lines (56 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php declare(strict_types=1);
namespace Fop\DependencyInjection;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\GlobFileLoader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutoBindParametersCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutoReturnFactoryCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\ConfigurableCollectorCompilerPass;
use Symplify\PackageBuilder\HttpKernel\SimpleKernelTrait;
use Symplify\PackageBuilder\Yaml\FileLoader\ParameterMergingYamlFileLoader;
final class FopKernel extends Kernel
{
use SimpleKernelTrait;
/**
* @var string|null
*/
private $config;
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__ . '/../../packages/*/config/config.yaml', 'glob');
$loader->load(__DIR__ . '/../../config/config.yaml');
if ($this->config) {
$loader->load($this->config);
}
}
public function bootWithConfig(string $config): void
{
$this->config = $config;
$this->boot();
}
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new AutoReturnFactoryCompilerPass());
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
$containerBuilder->addCompilerPass(new ConfigurableCollectorCompilerPass());
$containerBuilder->addCompilerPass(new AutoBindParametersCompilerPass());
}
/**
* @param ContainerInterface|ContainerBuilder $container
*/
protected function getContainerLoader(ContainerInterface $container): DelegatingLoader
{
$kernelFileLocator = new FileLocator($this);
$loaderResolver = new LoaderResolver([
new GlobFileLoader($kernelFileLocator),
new ParameterMergingYamlFileLoader($container, $kernelFileLocator),
]);
return new DelegatingLoader($loaderResolver);
}
}