forked from symfony-tasks/symfony-routing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMiniKernel.php
66 lines (53 loc) · 1.82 KB
/
MiniKernel.php
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
namespace BankiruSchool\Routing;
use BankiruSchool\Routing\DependencyInjection\ServiceCompilerPass;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\Kernel;
final class MiniKernel extends Kernel
{
/** {@inheritdoc} */
public function registerBundles()
{
return [];
}
/** {@inheritdoc} */
public function registerContainerConfiguration(LoaderInterface $loader)
{
}
public function getCacheDir()
{
return $this->getRootDir() . '/var/cache';
}
public function getRootDir()
{
return __DIR__;
}
public function getLogDir()
{
return $this->getRootDir() . '/var/logs';
}
protected function buildContainer()
{
$container = parent::buildContainer();
$container->register('event_dispatcher', EventDispatcher::class);
$container->register('controller_resolver', ControllerResolver::class);
$container->register('request_stack', RequestStack::class);
$container->register('argument_resolver', ArgumentResolver::class);
$container
->register('http_kernel', HttpKernel::class)
->setArguments([
new Reference('event_dispatcher'),
new Reference('controller_resolver'),
new Reference('request_stack'),
new Reference('argument_resolver'),
]);
$container->addCompilerPass(new ServiceCompilerPass());
return $container;
}
}