WalletBalanceCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
nc 1
nop 0
dl 0
loc 5
c 0
b 0
f 0
cc 1
rs 10
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