AccountCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php
2
namespace Graceland\SafeInCloud\Commands;
3
4
use Graceland\SafeInCloud\ApiClient;
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\Console\Question\Question;
11
12
class AccountCommand extends Command
13
{
14
    protected $client;
15
16
    public function __construct(ApiClient $client)
17
    {
18
        parent::__construct();
19
20
        $this->client = $client;
21
    }
22
23
    protected function configure()
24
    {
25
        $this->setName('accounts');
26
        $this->setDescription('Retrieve web accounts associated with an URL');
27
        $this->addArgument('url', InputArgument::REQUIRED, 'The URL you want to retrieve associated accounts for');
28
        $this->addOption('token', null, InputOption::VALUE_REQUIRED, 'Your authentication token');
29
    }
30
31 View Code Duplication
    protected function execute(InputInterface $input, OutputInterface $output)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $this->client->setAuthToken($input->getOption('token'));
34
        $this->client->doHandshake();
35
36
        $accounts = $this->client->getWebAccounts($input->getArgument('url'));
37
38
        $output->writeln(json_encode($accounts));
39
        return 0;
40
    }
41
}
42