-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
FlasherSymfonyBundle.php
40 lines (33 loc) · 1.22 KB
/
FlasherSymfonyBundle.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
<?php
declare(strict_types=1);
namespace Flasher\Symfony;
use Flasher\Prime\Container\FlasherContainer;
use Flasher\Prime\Plugin\FlasherPlugin;
use Flasher\Symfony\DependencyInjection\Compiler\EventListenerCompilerPass;
use Flasher\Symfony\DependencyInjection\Compiler\PresenterCompilerPass;
use Flasher\Symfony\DependencyInjection\FlasherExtension;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
final class FlasherSymfonyBundle extends Support\PluginBundle // Symfony\Component\HttpKernel\Bundle\Bundle
{
public function boot(): void
{
if ($this->container instanceof ContainerInterface) {
FlasherContainer::from($this->container);
}
}
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new EventListenerCompilerPass());
$container->addCompilerPass(new PresenterCompilerPass());
}
public function getContainerExtension(): ExtensionInterface
{
return new FlasherExtension($this->createPlugin());
}
public function createPlugin(): FlasherPlugin
{
return new FlasherPlugin();
}
}