GenerateKeysBootstrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBindings() 0 3 1
A registerBindings() 0 9 1
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