Conditions | 5 |
Paths | 12 |
Total Lines | 52 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
30 | public function handle() |
||
31 | { |
||
32 | // Get app config |
||
33 | $this->getScaffolderConfig(); |
||
34 | |||
35 | $overwrite = false; |
||
36 | |||
37 | if($this->option('overwrite')) |
||
38 | $overwrite = true; |
||
39 | |||
40 | $generate = false; |
||
41 | |||
42 | if($this->option('generate')) |
||
43 | $generate = true; |
||
44 | |||
45 | |||
46 | switch ($this->argument('app')) { |
||
47 | case 'webapp': |
||
|
|||
48 | |||
49 | // gera código somente se houver a opcao |
||
50 | if($generate) { |
||
51 | // Gera codigo da api |
||
52 | $this->call('scaffolder:generate', array('app' => 'api', '-c' => 'clear-all')); |
||
53 | |||
54 | // Se parametro --overwrite selecionado, copia arquivos para seu respectivo destino |
||
55 | $this->copyApiFiles($overwrite); |
||
56 | |||
57 | // Gera codigo da pasta webapp |
||
58 | $this->call('scaffolder:generate', array('app' => 'angularjs', '-c' => 'clear-all')); |
||
59 | |||
60 | // Se parametro --overwrite selecionado, copia arquivos para seu respectivo destino |
||
61 | $this->copyAngularjsFiles($overwrite); |
||
62 | } |
||
63 | |||
64 | $gulpCommand = sprintf('gulp serve --cwd "%s/codificar/scaffolder-theme-material/" > null', base_path('vendor')); |
||
65 | |||
66 | $this->info('Running gulp in serve mode, wait your browser open...'); |
||
67 | //$handle = popen($gulpCommand, 'r'); |
||
68 | |||
69 | $this->launchBackgroundProcess($gulpCommand); |
||
70 | |||
71 | // php artisan serve |
||
72 | $this->call('serve'); |
||
73 | |||
74 | break; |
||
75 | |||
76 | default: |
||
77 | $this->info('Invalid arguments'); |
||
78 | break; |
||
79 | } |
||
80 | |||
81 | } |
||
82 | |||
159 | } |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.