|
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); |
|
|
|
|
|
|
57
|
|
|
return 0; |
|
58
|
|
|
} |
|
59
|
|
|
} |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.