FlashServiceBootstrapper::getBindings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Bootstrappers\Session;
6
7
use AbterPhp\Framework\I18n\ITranslator;
8
use AbterPhp\Framework\Session\FlashService;
9
use Opulence\Ioc\Bootstrappers\Bootstrapper;
10
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
11
use Opulence\Ioc\IContainer;
12
use Opulence\Ioc\IocException;
13
use Opulence\Sessions\ISession;
14
15
class FlashServiceBootstrapper extends Bootstrapper implements ILazyBootstrapper
16
{
17
    /**
18
     * @inheritdoc
19
     */
20
    public function getBindings(): array
21
    {
22
        return [
23
            FlashService::class,
24
        ];
25
    }
26
27
    /**
28
     * @param IContainer $container
29
     *
30
     * @throws IocException
31
     */
32
    public function registerBindings(IContainer $container): void
33
    {
34
        $session    = $container->resolve(ISession::class);
35
        $translator = $container->resolve(ITranslator::class);
36
37
        $flashService = new FlashService($session, $translator);
38
39
        $container->bindInstance(FlashService::class, $flashService);
40
    }
41
}
42