WalletCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A initialize() 0 5 1
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