Conditions | 6 |
Paths | 18 |
Total Lines | 92 |
Code Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 0 | Features | 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 | $this->info('Starting Installation of Artomator.'); |
||
33 | $bar = $this->output->createProgressBar(4); |
||
34 | $bar->start(); |
||
35 | // Publish... |
||
36 | $this->callSilent( |
||
37 | 'vendor:publish', |
||
38 | [ |
||
39 | '--tag' => 'artomator', |
||
40 | '--force' => true, |
||
41 | ] |
||
42 | ); |
||
43 | $bar->advance(); |
||
44 | $this->callSilent( |
||
45 | 'vendor:publish', |
||
46 | [ |
||
47 | '--provider' => 'InfyOm\Generator\InfyOmGeneratorServiceProvider', |
||
48 | '--force' => true, |
||
49 | ] |
||
50 | ); |
||
51 | $bar->advance(); |
||
52 | $this->callSilent( |
||
53 | 'vendor:publish', |
||
54 | [ |
||
55 | '--tag' => 'lighthouse-schema', |
||
56 | '--force' => true, |
||
57 | ] |
||
58 | ); |
||
59 | $bar->advance(); |
||
60 | $this->callSilent( |
||
61 | 'vendor:publish', |
||
62 | [ |
||
63 | '--tag' => 'lighthouse-config', |
||
64 | '--force' => true, |
||
65 | ] |
||
66 | ); |
||
67 | $bar->finish(); |
||
68 | $this->newLine(); |
||
69 | $this->info('Config files published. (4/4)'); |
||
70 | |||
71 | $this->call('artomator:publish'); |
||
72 | |||
73 | $this->info('Artomator base files published.'); |
||
74 | |||
75 | $aliases = [ |
||
76 | "'View' => Illuminate\Support\Facades\View::class", |
||
77 | "'Form' => Collective\Html\FormFacade::class", |
||
78 | "'Html' => Collective\Html\HtmlFacade::class", |
||
79 | "'Flash' => Laracasts\Flash\Flash::class", |
||
80 | ]; |
||
81 | |||
82 | $this->replaceInFile( |
||
83 | "'View' => Illuminate\Support\Facades\View::class", |
||
84 | implode(",\n\t\t", $aliases), |
||
85 | config_path('app.php') |
||
86 | ); |
||
87 | |||
88 | $template = $this->choice( |
||
89 | 'Choose your templating package', |
||
90 | ['CoreUI', 'AdminLTE'], |
||
91 | 0 |
||
92 | ); |
||
93 | |||
94 | if ('CoreUI' === $template) { |
||
95 | $this->replaceInFile( |
||
96 | "'templates' => 'adminlte-templates',", |
||
97 | "'templates' => 'coreui-templates',", |
||
98 | config_path('infyom/laravel_generator.php') |
||
99 | ); |
||
100 | $this->requireComposerPackages('infyomlabs/coreui-templates:^8.0.x-dev'); |
||
101 | } elseif ('AdminLTE' === $template) { |
||
102 | $this->requireComposerPackages('infyomlabs/adminlte-templates:^8.0.x-dev'); |
||
103 | } |
||
104 | $this->newLine(); |
||
105 | $this->info('Template package added to composer.'); |
||
106 | |||
107 | if (true === $this->confirm('Do you want to install Laravel Jetstream (Inertia & Vue)?')) { |
||
108 | $this->requireComposerPackages('laravel/jetstream'); |
||
109 | if (true === $this->confirm('Do you want to support Laravel Jetstream Teams?')) { |
||
110 | $this->call('jetstream:install', ['stack' => 'inertia', '--teams']); |
||
111 | } else { |
||
112 | $this->call('jetstream:install', ['stack' => 'inertia']); |
||
113 | } |
||
114 | $this->info('Laravel Jetstream Installed.'); |
||
115 | } |
||
116 | |||
117 | if (true === $this->confirm('Do you want to publish the stub files?')) { |
||
118 | $this->call('artomator.publish:templates'); |
||
119 | $this->info('Stub files published.'); |
||
120 | } |
||
121 | $this->info('Thanks for installing Artomator.'); |
||
122 | } |
||
216 |