WalletBalanceCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
c 0
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\ChargeableApi\Bridge\Symfony\Console\Command;
6
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\Console\Style\SymfonyStyle;
11
12
final class WalletBalanceCommand extends WalletCommand
13
{
14
    protected static $defaultName = 'damax:chargeable-api:wallet:balance';
15
16
    protected function configure()
17
    {
18
        $this
19
            ->setDescription('Get wallet balance.')
20
            ->addArgument('identity', InputArgument::REQUIRED, 'Identity.')
21
        ;
22
    }
23
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        $identity = $this->identityFactory->create();
27
28
        $balance = $this->walletFactory->create($identity)->balance();
29
30
        (new SymfonyStyle($input, $output))->success(sprintf('Balance: %d', $balance->toInteger()));
31
    }
32
}
33