DashboardBootstrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 25
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerBindings() 0 8 1
A getBindings() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Bootstrappers\Dashboard;
6
7
use AbterPhp\Framework\Constant\Event;
8
use AbterPhp\Framework\Dashboard\Dashboard;
9
use AbterPhp\Framework\Events\DashboardReady;
10
use Opulence\Events\Dispatchers\IEventDispatcher;
11
use Opulence\Ioc\Bootstrappers\Bootstrapper;
12
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
13
use Opulence\Ioc\IContainer;
14
15
class DashboardBootstrapper extends Bootstrapper implements ILazyBootstrapper
16
{
17
    /**
18
     * @inheritdoc
19
     */
20
    public function getBindings(): array
21
    {
22
        return [
23
            Dashboard::class,
24
        ];
25
    }
26
27
    /**
28
     * @param IContainer $container
29
     *
30
     * @throws \Opulence\Ioc\IocException
31
     */
32
    public function registerBindings(IContainer $container): void
33
    {
34
        $dashboard = new Dashboard();
35
36
        $eventDispatcher = $container->resolve(IEventDispatcher::class);
37
        $eventDispatcher->dispatch(Event::DASHBOARD_READY, new DashboardReady($dashboard));
38
39
        $container->bindInstance(Dashboard::class, $dashboard);
40
    }
41
}
42