Passed
Push — master ( 064793...c708b1 )
by Peter
02:48
created

GenerateKeysBootstrapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 22
rs 10
c 0
b 0
f 0
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 Opulence\Ioc\Bootstrappers\Bootstrapper;
10
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
11
use Opulence\Ioc\IContainer;
12
13
class GenerateKeysBootstrapper extends Bootstrapper implements ILazyBootstrapper
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function getBindings(): array
19
    {
20
        return [GenerateKeys::class];
21
    }
22
23
    /**
24
     * @inheritdoc
25
     */
26
    public function registerBindings(IContainer $container)
27
    {
28
        $privateKeyPassword = getenv(Env::OAUTH2_PRIVATE_KEY_PASSWORD);
29
        $privateKeyPath     = getenv(Env::OAUTH2_PRIVATE_KEY_PATH);
30
        $publicKeyPath      = getenv(Env::OAUTH2_PUBLIC_KEY_PATH);
31
32
        $command = new GenerateKeys($privateKeyPassword, $privateKeyPath, $publicKeyPath);
33
34
        $container->bindInstance(GenerateKeys::class, $command);
35
    }
36
}
37