Conditions | 5 |
Paths | 9 |
Total Lines | 70 |
Code Lines | 33 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 namespace crocodicstudio\crudbooster\commands; |
||
32 | public function handle() |
||
33 | { |
||
34 | |||
35 | $this->header(); |
||
36 | |||
37 | $this->checkRequirements(); |
||
38 | |||
39 | $this->info('Installing: '); |
||
40 | |||
41 | if ($this->confirm('Do you have setting the database configuration at .env ?')) { |
||
42 | |||
43 | if (! file_exists(public_path('vendor')) ) { |
||
44 | mkdir(public_path('vendor')); |
||
45 | } |
||
46 | |||
47 | $this->info('Please wait CRUDBooster publish assets...'); |
||
48 | $this->call('vendor:publish', ['--tag' => 'cb_config']); |
||
49 | $this->call('vendor:publish', ['--tag' => 'cb_hook']); |
||
50 | $this->call('vendor:publish', ['--tag' => 'cb_asset', '--force' => true]); |
||
51 | $this->call('vendor:publish', ['--tag' => 'cb_migration', '--force' => true]); |
||
52 | |||
53 | /* |
||
54 | * Add some env for CB |
||
55 | */ |
||
56 | setEnvironmentValue([ |
||
57 | "APP_DEBUG"=> false |
||
58 | ]); |
||
59 | |||
60 | /* |
||
61 | * Create CBPlugins |
||
62 | */ |
||
63 | if(!file_exists(app_path("CBPlugins"))) { |
||
64 | mkdir(app_path("CBPlugins")); |
||
65 | } |
||
66 | |||
67 | /* |
||
68 | * Create storage dir on public |
||
69 | * We need it to change default laravel local filesystem from storage to public |
||
70 | * We won't use symlink because of a security issue in many server |
||
71 | */ |
||
72 | if(!file_exists(public_path("storage"))) { |
||
73 | $this->info("Create storage directory on /public"); |
||
74 | mkdir(public_path("storage")); |
||
75 | file_put_contents(public_path("storage/.gitignore"),"!.gitignore"); |
||
76 | file_put_contents(public_path("storage/index.html")," "); |
||
77 | } |
||
78 | |||
79 | /* |
||
80 | * We want to add more security to your Laravel |
||
81 | * Disable index listing |
||
82 | * Disable php execution on /vendor/* |
||
83 | */ |
||
84 | $this->info("Tweak some security for your laravel"); |
||
85 | file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
||
86 | file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
||
87 | |||
88 | |||
89 | $this->info('Dumping the autoloaded files and reloading all new files...'); |
||
90 | ComposerHelper::dumpAutoLoad(); |
||
91 | |||
92 | $this->info('Migrating database...'); |
||
93 | $this->call('migrate'); |
||
94 | $this->call('config:clear'); |
||
95 | $this->info('Installing CRUDBooster Is Completed ! Thank You :)'); |
||
96 | } else { |
||
97 | $this->info('Setup Aborted !'); |
||
98 | $this->info('Please setting the database configuration for first !'); |
||
99 | } |
||
100 | |||
101 | $this->footer(); |
||
102 | } |
||
221 |