mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
6c20d257e3
d3d18d442c
keep relative paths
48 lines
2.1 KiB
PHP
48 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace RectorPrefix202209\Symplify\SymplifyKernel\HttpKernel;
|
|
|
|
use RectorPrefix202209\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
use RectorPrefix202209\Symfony\Component\DependencyInjection\Container;
|
|
use RectorPrefix202209\Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use RectorPrefix202209\Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
|
use RectorPrefix202209\Symplify\AutowireArrayParameter\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
|
|
use RectorPrefix202209\Symplify\SymplifyKernel\Config\Loader\ParameterMergingLoaderFactory;
|
|
use RectorPrefix202209\Symplify\SymplifyKernel\ContainerBuilderFactory;
|
|
use RectorPrefix202209\Symplify\SymplifyKernel\Contract\LightKernelInterface;
|
|
use RectorPrefix202209\Symplify\SymplifyKernel\Exception\ShouldNotHappenException;
|
|
use RectorPrefix202209\Symplify\SymplifyKernel\ValueObject\SymplifyKernelConfig;
|
|
/**
|
|
* @api
|
|
*/
|
|
abstract class AbstractSymplifyKernel implements LightKernelInterface
|
|
{
|
|
/**
|
|
* @var \Symfony\Component\DependencyInjection\Container|null
|
|
*/
|
|
private $container = null;
|
|
/**
|
|
* @param string[] $configFiles
|
|
* @param CompilerPassInterface[] $compilerPasses
|
|
* @param ExtensionInterface[] $extensions
|
|
*/
|
|
public function create(array $configFiles, array $compilerPasses = [], array $extensions = []) : ContainerInterface
|
|
{
|
|
$containerBuilderFactory = new ContainerBuilderFactory(new ParameterMergingLoaderFactory());
|
|
$compilerPasses[] = new AutowireArrayParameterCompilerPass();
|
|
$configFiles[] = SymplifyKernelConfig::FILE_PATH;
|
|
$containerBuilder = $containerBuilderFactory->create($configFiles, $compilerPasses, $extensions);
|
|
$containerBuilder->compile();
|
|
$this->container = $containerBuilder;
|
|
return $containerBuilder;
|
|
}
|
|
public function getContainer() : \RectorPrefix202209\Psr\Container\ContainerInterface
|
|
{
|
|
if (!$this->container instanceof Container) {
|
|
throw new ShouldNotHappenException();
|
|
}
|
|
return $this->container;
|
|
}
|
|
}
|