Passed
Push — master ( 7ba2cb...1d30f9 )
by Peter
02:20
created

ProfileBootstrapper::getBindings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Bootstrappers\Http\Controllers\Form;
6
7
use AbterPhp\Admin\Form\Factory\Profile as FormFactory;
8
use AbterPhp\Admin\Http\Controllers\Admin\Form\Profile;
9
use AbterPhp\Admin\Orm\UserRepo as Repo;
10
use AbterPhp\Framework\Assets\AssetManager;
11
use AbterPhp\Framework\Constant\Env;
12
use AbterPhp\Framework\I18n\ITranslator;
13
use AbterPhp\Framework\Session\FlashService;
14
use Opulence\Events\Dispatchers\IEventDispatcher;
15
use Opulence\Ioc\Bootstrappers\Bootstrapper;
16
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
17
use Opulence\Ioc\IContainer;
18
use Opulence\Routing\Urls\UrlGenerator;
19
use Opulence\Sessions\ISession;
20
21
class ProfileBootstrapper extends Bootstrapper implements ILazyBootstrapper
22
{
23
    /**
24
     * @return array
25
     */
26
    public function getBindings(): array
27
    {
28
        return [
29
            Profile::class,
30
        ];
31
    }
32
33
    /**
34
     * @param IContainer $container
35
     */
36
    public function registerBindings(IContainer $container)
37
    {
38
        $flashService    = $container->resolve(FlashService::class);
39
        $translator      = $container->resolve(ITranslator::class);
40
        $urlGenerator    = $container->resolve(UrlGenerator::class);
41
        $repo            = $container->resolve(Repo::class);
42
        $session         = $container->resolve(ISession::class);
43
        $formFactory     = $container->resolve(FormFactory::class);
44
        $assets          = $container->resolve(AssetManager::class);
45
        $eventDispatcher = $container->resolve(IEventDispatcher::class);
46
        $frontendSalt    = getenv(Env::CRYPTO_FRONTEND_SALT);
47
48
        $profileController = new Profile(
49
            $flashService,
50
            $translator,
51
            $urlGenerator,
52
            $repo,
53
            $session,
54
            $formFactory,
55
            $eventDispatcher,
56
            $assets,
57
            $frontendSalt
58
        );
59
60
        $container->bindInstance(Profile::class, $profileController);
61
    }
62
}
63