WalletCommand::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\ChargeableApi\Bridge\Symfony\Console\Command;
6
7
use Damax\ChargeableApi\Identity\FixedIdentityFactory;
8
use Damax\ChargeableApi\Identity\IdentityFactory;
9
use Damax\ChargeableApi\Wallet\WalletFactory;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
abstract class WalletCommand extends Command
15
{
16
    protected $walletFactory;
17
18
    /**
19
     * @var IdentityFactory
20
     */
21
    protected $identityFactory;
22
23
    public function __construct(WalletFactory $walletFactory)
24
    {
25
        parent::__construct();
26
27
        $this->walletFactory = $walletFactory;
28
    }
29
30
    protected function initialize(InputInterface $input, OutputInterface $output)
31
    {
32
        $identity = $input->getArgument('identity') ?? '';
33
34
        $this->identityFactory = new FixedIdentityFactory((string) $identity);
35
    }
36
}
37