Passed
Branch develop (6d6783)
by BENARD
03:42
created

TwitterCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 2
A configure() 0 8 1
1
<?php
2
3
namespace VideoGamesRecords\DwhBundle\Command;
4
5
use Exception;
6
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class TwitterCommand extends Command
12
{
13
    protected static $defaultName = 'vgr-dwh:twitter';
14
15
    protected function configure()
16
    {
17
        $this->setName('vgr-dwh:twitter')
18
            ->setDescription('Command to dialog with twitter')
19
            ->addArgument(
20
                'function',
21
                InputArgument::REQUIRED,
22
                'Who do you want to do?'
23
            );
24
    }
25
26
    /**
27
     * @param InputInterface  $input
28
     * @param OutputInterface $output
29
     * @return bool
30
     * @throws Exception
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $function = $input->getArgument('function');
35
        switch ($function) {
36
            case 'poke':
37
                exit;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
38
                break;
39
        }
40
        return 0;
0 ignored issues
show
Bug Best Practice introduced by
The expression return 0 returns the type integer which is incompatible with the documented return type boolean.
Loading history...
41
    }
42
}
43