Completed
Push — master ( bd4c23...b341c0 )
by Filipe
10:29
created

BuildWebApp   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of slick/mvc package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Mvc\Console\Command;
11
12
use Slick\Mvc\Console\Command\Task\AskForWebRoot;
13
use Slick\Mvc\Console\Service\ContainerFactory;
14
use Symfony\Component\Console\Command\Command;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * BuildWebApp
20
 *
21
 * @package Slick\Mvc\Console\Command
22
 * @author  Filipe Silva <[email protected]>
23
 */
24
class BuildWebApp extends Command
25
{
26
27
    /**
28
     * Configure command
29
     */
30
    protected function configure()
31
    {
32
        $this
33
            ->setName('init')
34
            ->setDescription('Builds a basic, startup files and directory structure for a web application.')
35
        ;
36
    }
37
38
    /**
39
     * Executes the current command.
40
     *
41
     * This method is not abstract because you can use this class
42
     * as a concrete class. In this case, instead of defining the
43
     * execute() method, you set the code to execute by passing
44
     * a Closure to the setCode() method.
45
     *
46
     * @param InputInterface  $input  An InputInterface instance
47
     * @param OutputInterface $output An OutputInterface instance
48
     *
49
     * @return null|int null or 0 if everything went fine, or an error code
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        $container = ContainerFactory::create($this)->container();
54
        $output->writeln('<info>Slick web application initialization</info>');
55
        $output->writeln('<info>------------------------------------</info>');
56
        $webRoot = $container->get(AskForWebRoot::class)->execute($input, $output);
0 ignored issues
show
Unused Code introduced by
$webRoot is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
57
        return 0;
58
    }
59
}