Hello::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Equip\Console\Command;
4
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\Output\OutputInterface;
9
10
class Hello extends Command
11
{
12
    protected function configure()
13
    {
14
        $this
15
            ->setName('hello')
16
            ->setDescription('Example command')
17
            ->addArgument(
18
                'name',
19
                InputArgument::OPTIONAL,
20
                'Who do you want to say hello to?'
21
            );
22
    }
23
24
    public function execute(
25
        InputInterface $input,
26
        OutputInterface $output
27
    ) {
28
        $name = $input->getArgument('name') ?: 'world';
29
30
        $output->writeln(sprintf('Hello, %s!', $name));
31
    }
32
}
33