AbstractCommand::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Incapsula\Command;
6
7
use Incapsula\Client;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
abstract class AbstractCommand extends Command
14
{
15
    /**
16
     * @var Client;
17
     */
18
    protected $client;
19
20
    protected function configure(): void
21
    {
22
        $this->addOption('profile', 'p', InputOption::VALUE_OPTIONAL, 'Incapsula profile');
23
    }
24
25
    protected function initialize(InputInterface $input, OutputInterface $output): void
26
    {
27
        $this->client = new Client([
28
            'profile' => $input->getParameterOption(['--profile', '-p']),
29
        ]);
30
    }
31
}
32