GenerateKeysBootstrapper::getBindings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Bootstrappers\Console\Commands\Oauth2;
6
7
use AbterPhp\Framework\Console\Commands\Oauth2\GenerateKeys;
8
use AbterPhp\Framework\Constant\Env;
9
use AbterPhp\Framework\Environments\Environment;
10
use Opulence\Ioc\Bootstrappers\Bootstrapper;
11
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
12
use Opulence\Ioc\IContainer;
13
14
class GenerateKeysBootstrapper extends Bootstrapper implements ILazyBootstrapper
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    public function getBindings(): array
20
    {
21
        return [GenerateKeys::class];
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function registerBindings(IContainer $container): void
28
    {
29
        $privateKeyPassword = Environment::mustGetVar(Env::OAUTH2_PRIVATE_KEY_PASSWORD);
30
        $privateKeyPath     = Environment::mustGetVar(Env::OAUTH2_PRIVATE_KEY_PATH);
31
        $publicKeyPath      = Environment::mustGetVar(Env::OAUTH2_PUBLIC_KEY_PATH);
32
33
        $command = new GenerateKeys($privateKeyPassword, $privateKeyPath, $publicKeyPath);
34
35
        $container->bindInstance(GenerateKeys::class, $command);
36
    }
37
}
38